in reply to Better Way to Do It

A couple of things, you don't need to quote variables in perl as you might in the shell and you might want to check for the existence of the file. Here's my take on the exercise
{ print "Enter filename: "; chomp($f = <STDIN>); print "invalid file" and redo unless -f $f and -r $f; } open(f) and print reverse <f>;
A little idiomatic admittedly, but that's fine by me :)
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Better Way to Do It
by Abigail-II (Bishop) on May 17, 2003 at 23:03 UTC
    Your solution is less powerful than other presented solutions. Due to your explicite requirements only standard files can be given, your program can't unleash the power of the magical open. Your program can't reverse text given on standard input, or what comes from a pipe.

    Abigail

      Your solution is less powerful than other presented solutions
      Since the exercise was to print a file in reversed order, and that's what my code does, I'm hardly going to be loosing any sleep over this ;)
      HTH

      _________
      broquaint