oryann9 wrote:
> Please advise on the small amount of code b/c I am
> getting the message as below, but the code is working
> and output how I want it, just trying to rid of
> messages.
>
> thank you!
>
>
> Use of uninitialized value in concatenation (.) or
> string at
> JFS_version_parser.pl line 20, <JFS> line 952 (#1)
>
> Use of uninitialized value in concatenation (.) or
> string at
> JFS_version_parser.pl line 21, <JFS> line 952 (#1)
>
> Use of uninitialized value in concatenation (.) or
> string at
> JFS_version_parser.pl line 21, <JFS> line 956 (#1)
>
> Use of uninitialized value in concatenation (.) or
> string at
> JFS_version_parser.pl line 22, <JFS> line 956 (#1)
>
>
> use strict;
> use warnings;
> use diagnostics;
>
> my $jfsFile = qq(/tmp/onlinJFS_4_license_exp.txt);
> my $CvsFile = qq(/tmp/onlinJFS_4_license_exp.cvs);
> my $regexp =
> qr/(host:\w+)|(onlinejfs.*)|(jfs\sversion.*)/is;
You are using three sets of capturing parentheses so either $1 will match and
$2 and $3 will be undef or $2 will match and $1 and $3 will be undef or $3
will match and $1 and $2 will be undef. You should change that to one set of
capturing parentheses:
my $regexp = qr/(host:\w+|onlinejfs.*|jfs\sversion.*)/is;
> my ($host,$swlist,$kernel) = 0;
>
> open (JFS, "+<$jfsFile") or die "file '$jfsFile' was
> not opened $!";
>
> while (<JFS>) {
> s/^\s+|\s+$//g;
> next if ! length $_;
>
> if (/$regexp/) {
> ($host,$swlist,$kernel) = ($1, $2, $3);
> print "\n$1";
> print "\t$2";
> print "$3\n";
> }
With only one set of capturing parentheses change that to:
if (/$regexp/) {
print "\n$1\n";
}
> }
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/