Monday, 18 March 2013

making file as array

#!/usr/bin/perl
open(FILE,"/etc/passwd");
while($line=<FILE>)
{
@s=split(":",$line);
$e=(@s - 1);

print $s[(@s - 2)]."\n";
}
close(FILE);

No comments:

Post a Comment