in reply to Re: Terminating Read Of Input
in thread Terminating Read Of Input
And to make your intention slightly more obvious you can label the loop:
READ_TILL_TOTAL: while (my $line = <$fh>) { chomp($line); last READ_TILL_TOTAL if ($line =~ /TOTAL COMMAND SUMMARY/); my ($uid, $login, $cpupr, $cpunpr, @data) = (split("\t",$line)); }
This is especially helpful if you've got other loops around this block, for example a loop that opens a list of files and reads them all in turn.
|
|---|