in reply to Binary conditionals

Now that moritz has answered your question, I have a question of my own.

I can't compile

my IN, "<infile.dat"; my OUT, ">outfile.dat";

Is this what your code looked like when you ran it, or did something get mangled on the way to being posted here?

Replies are listed 'Best First'.
Re^2: Binary conditionals
by Illuminatus (Curate) on Sep 30, 2008 at 15:16 UTC
    Yes, the post was incomplete. Subsequent posts using
    open my IN, "<infile.dat";
    or similar were correct.
      Not quite. This gives an error message:
      No such class IN at ./714572.pl line 10, near "open my IN" syntax error at ./714572.pl line 10, near "my IN," Execution of ./714572.pl aborted due to compilation errors.

      moritz's code has it right because he uses a lexical filehandle. He also uses the recommended 3-argument form of open and checks its status:

      open my $in, '<:raw', 'infile.dat' or die $!;
        Look out for the open parameters.
        You should distinguish between IN in file handle context and my $IN as scalar.
        my IN probably won't work while my $IN would.

        Regards,
        s++ą  ł˝ ął. Ş ş şą Żľ ľą˛ş ą ŻĽąş.}++y~-~?-{~/s**$_*ee