in reply to Re: array processing
in thread array processing
This doesn't work though since $linenum is still set to 1 at the print above. How can I use the linenum variable outside the while loop to achieve this ?my $linenum = 1; my $lastline = 200; my %user_login; while (my $line = <errlog>) { chomp $line; next unless ($linenum = $lastline); next unless ($line =~ /Login succeeded/); my ($date,$time,$username)=(split(' ',$line))[0,1,6]; $user_login{$username}="$date $time"; ++linenum; } for my $record(sort keys %user_login) { print "$record logged in at $user_login{$record}\n"; } print "line number is $linenum\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: array processing
by tirwhan (Abbot) on Dec 06, 2005 at 12:58 UTC | |
by Anonymous Monk on Dec 06, 2005 at 13:12 UTC | |
by Anonymous Monk on Dec 06, 2005 at 13:31 UTC |