If you wanted to reverse the contents of a file, use below perl script:
#!/usr/bin/perl
$filename = "a.java";
open(INFILE, "<", $filename)
or die "Can't open $filename for reading: $!\n";
my(@content) =
close(INFILE);
while (@content) {
my($line) = pop(@content);
chomp $line;
print reverse($line)."\n";
}
Thursday, August 14, 2008
Reverse the contents of a file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment