What does it do when you try it?
I'm seeing an empty output file.
One thing I see right now is that you are attempting to print the reverse of each line, but you are reading the lines sequentially, which will not give the result you want. Also, you should get used to always "use strict"ing.
Further googling reveals that
Reverse both the order of the lines and the text order inside each line perl -e 'print scalar reverse <>'
So if I change my program to
#!/usr/bin/perl -e use strict; $a= "myin.txt"; $b="myout.txt"; open(IN, $a) || die "cannot open $a for reading: $!"; open(OUT, ">$b") || die "cannot open $b for reading: $!"; while (<IN>) { print scalar reverse OUT $_; } close (IN) || die "cannot close $a: $!"; close (OUT) || die "cannot close $b: $!";
but no myout.txt created.
-----Original Message-----
From: Norman Zhang Sent: Thursday, January 01, 2004 11:36 PM
I want to list each character of the file backwards.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>