in reply to Seeing double
Couple of quick ideas:
my $flag=0; for($i=0; $i<$glob; $i++){ $_ = @text[$i]; if(/Email address:/){ print $_; } elsif(/Message-Id:/ and !$flag++){ print $_; } }
Or alternatively
my ($email,$mesgid)= ("",""); for($i=0; $i<$glob; $i++){ $_ = @text[$i]; if(/Email address:/){ $email = $_; } elsif(/Message-Id:/){ $mesgid = $_; } } print $email,$mesgid;
And a question: why the for loop, instead of
?while (<TEXT>){ ... }
If God had meant us to fly, he would *never* have give us the railroads.
--Michael Flanders
|
|---|