Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: input from STDIN or from a file

by almut (Canon)
on Jan 28, 2008 at 19:17 UTC ( #664751=note: print w/ replies, xml ) Need Help??


in reply to Re: input from STDIN or from a file
in thread input from STDIN or from a file

#!/usr/bin/perl - ^

I'm not sure you want the dash at the end of the shebang line...

It doesn't do any harm when invoking the code like you did, but when I try to run your sample code/data without explicitly calling perl (rather letting the OS handle the shebang), I'm getting

$ cat file.txt | ./664708.pl Can't locate object method "a" via package "b" (perhaps you forgot to +load "b"?) at - line 1.

I suppose this is because what comes in through stdin is being interpreted as Perl code, rather than as content to be read via <> ...


Comment on Re^2: input from STDIN or from a file
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://664751]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-12-29 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (187 votes), past polls