I have a text file with 5 or more lines as in:
My name is this and that
I live in Denver Colorado
I live in washington
I live in Denver Virginia
I am trying to read this file and print each line and each word in reverse order as in:
ainigriv revned ni evil I (the output starts with the last last of the file and
reverse each work as well).
Here is what I have done, but does not work:
print "Enter a file name:\n";
my $file = <STDIN>;
open (REGFILE, "$file") or die ("Cannot open file: $file: $!");
while(my @line = <REGFILE>) {
foreach my $lin(@line){
my @lines = $lin;
print reverse(@lines);
}
}
Any ideas! Thanks in advance
__________________________________________________________________
Introducing the New Netscape Internet Service.
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>