What does it do when you try it?

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.

-----Original Message-----
From: Norman Zhang [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 01, 2004 11:36 PM
To: Randy W. Sims
Cc: [EMAIL PROTECTED]
Subject: Re: create file


I want to list each character of the file backwards.

-----------------------<snip>---------------------------

#!/usr/bin/perl -w
$a= "/location/infilename";
$b="/location/outfilename";

open(IN, $a) || die "cannot open $a for reading: $!";
open(OUT, ">$b") || die "cannot open $b for reading: $!";
while (<IN>) {
   print reverse OUT $_;
}
close (IN) || die "cannot close $a: $!";
close (OUT) || die "cannot close $b: $!";

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to