On Aug 16, Ramprasad said:

>open IN , $inputfile || die "COuldnot open in file\n";

A see many things unfavorable here.  Because you're using the || operator,
the only time die() will be called is if $inputfile is a false value.  You
haven't included the filename nor $! in the error message, and I would
even suggest adding "< " to the filename, in the open() call.  And putting
a newline at the end of die() keeps it from printing line number and
filename.

Either do

  open IN, "< $inputfile" or die "cannot read $inputfile: $!";

or

  open(IN, "< $inputfile") || die "cannot read $inputfile: $!";

>@lines = <IN>;   # Not the best way but this is what your eg does
>close IN;        # file name not reqd here

>open OUT , ">$outputfile" || die "COuldnot open out file\n";

This suffers the same critique.

  open OUT, "> $outpufile" or die "cannot write $outputfile: $!";

>print OUT , "@lines";  # Again not the best way ,
>                        # and dont put an '=' here

This has two errors.  There is not allowed to be a comma after the
filehandle you're printing to (warnings would've told you that), and
putting the array in quotes will add a space in front of each line by the
first, because "@data" is really join($", @data), and $" defaults to " ".

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to