in reply to Newbie Question - arrays
$file = "ex1.pl"; open(MAIL, "$file") || die "cant open spool\n"; @array = <MAIL>; close (MAIL); foreach $line_num (0 .. $#array) { chomp($array[$line_num]);#prepare for m// if ($array[$line_num] =~ /^\s*$/) {#a blank line foreach (1 .. 3) { print $array[$line_num + $_];#remember those are not chomp +'d } last;#without this you will see the warning about uninitialize +d values you saw } }
|
|---|