Scot Robnett wrote:
> By writing it this way:
> 
>       open(OUTPUTFILE, ">". $outputFile);
> 
> the script thinks that you are trying to open a file called
> 
>       >Out_input2.txt
> 
> with the "greater than" sign actually being part of the file name.
> But what you want to do is open
> 
>       Out_input2.txt
> 
> for writing, in which case the "greater than" sign, which means "open
> this file for writing," needs to be contained inside the quotes.
> 
>       open(OUTPUTFILE, ">$outputFile");

No. Those two forms are equivalent.

">$outputFile" actually compiles to ">" . $outputFile internally:

$ perl -MO=Terse,exec -e '">$outputFile"'
OP (0x80f6fe0) enter
COP (0x81025c0) nextstate
SVOP (0x80f6320) const  PV (0x8103490) ">"
SVOP (0x80f6ee0) gvsv  GV (0x8103430) *outputFile
BINOP (0x80f6f60) concat [1]
LISTOP (0x80f6fc0) leave [1]
-e syntax OK

$ perl -MO=Terse,exec -e '">" . $outputFile'
OP (0x80f6fc0) enter
COP (0x81025c0) nextstate
SVOP (0x80f6320) const  PV (0x8103490) ">"
SVOP (0x80f6f00) gvsv  GV (0x80f8210) *outputFile
BINOP (0x80f6f80) concat [1]
LISTOP (0x80f6fa0) leave [1]
-e syntax OK

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

Reply via email to