Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: getting wrong value

by AnomalousMonk (Chancellor)
on Jan 16, 2013 at 01:34 UTC ( #1013480=note: print w/replies, xml ) Need Help??

in reply to getting wrong value

From the updated OP:

$line2 = capture_stdout($line) ; ... sub capture_stdout() { ... }

The function  capture_stdout() { ... } is prototyped to take no arguments and is called with one argument (which is not used!), but the code is executed in such an order as to avoid prototype checking. I suspect the code is also being run without warnings, thus avoiding the "function name called too early to check prototype..." message.

pvaldes has pointed out the way to explicitly defeat prototype checking, but if you're going to avoid or defeat prototype checking, why bother to use prototyping in the first place?

Please see Prototypes in perlsub and Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen – and then don't use prototypes unless you really need to and really understand their intended usage.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013480]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-05-27 05:36 GMT
Find Nodes?
    Voting Booth?