Here's a simple one!! But I don't get it?
I'm using the loop below to pull info from url's
Anyhow, this works fine. But with warnings on I'm getting about 75 copies of the warning: "Use of uninitialized value in pattern match (m//) at URL_Finder.pl line 18, <FILE> line 315."
Line 18 is: @contents = (@contents, $2) if ($2 !~ /^$/);
Specifically perl seems to have a problem with the use of $2.
Line 315 is the last line in the <FILE>.
Can anyone fill me in?
I'm using the loop below to pull info from url's
Anyhow, this works fine. But with warnings on I'm getting about 75 copies of the warning: "Use of uninitialized value in pattern match (m//) at URL_Finder.pl line 18, <FILE> line 315."
Line 18 is: @contents = (@contents, $2) if ($2 !~ /^$/);
Specifically perl seems to have a problem with the use of $2.
Line 315 is the last line in the <FILE>.
Can anyone fill me in?
Code:
my @fileContents;
for (<FILE>)
{
chomp;
if ($_ !~ /^$/)
{
$_ =~ m!(//)[w]*\.?([^/]+)!i;
@fileContents = (@fileContents, $2) if ($2 !~ /^$/);
}
}