> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> my @a = qw(abc def ghi);
> 
> for my $s (@a) {
>         $s =~ /(b)|(e)|(h)/;
>         print "1 => [$1] 2 => [$2] 3 => [$3]\n";
> }
> 

Thank you for the kind replies. I understand now and
have modified the code to:

use strict;
use warnings;

my $jfsFile =
qq(/home/dbsmith/onlinJFS_4_license_exp.txt);
my $CvsFile =
qq(/home/dbsmith/onlinJFS_4_license_exp.cvs);
my $regexp  = qr/(host:\w+)/is;
my $regexp1 = qr/(onlinejfs.*)/is;
my $regexp2 = qr/(jfs\sversion.*)/is;

open (JFS, "+<$jfsFile") or die "file '$jfsFile' was
not opened $!";

    while (<JFS>) {
        s/^\s+|\s+$//g;         ## rid of newlines at
begin and end
        next if ! length $_;    ## skip line of length
undef

        if (/$regexp/) {
            print "\n$1\n",
            '-' x length $1;
        }
        elsif (/$regexp1/) {
            print "\n\t$1\n";
        }
        elsif (/$regexp2/) {
            print "\n\t$1\n";
        }
    }



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to