Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Prototyping - is it necessary?

by Codon (Friar)
on Aug 31, 2005 at 22:24 UTC ( #488255=note: print w/replies, xml ) Need Help??

in reply to Prototyping - is it necessary?

You have another bug in your code (or you transcribed it incorrectly):

(my $datafile, $chomp) = @_;
my is not going to apply to $chomp. Under strict, this should throw an error Global symbol "$chomp" requires explicit package name.

Try this instead:

my ($datafile, $chomp) = @_;
Ivan Heffner
Sr. Software Engineer, DAS Lead, Inc.

Replies are listed 'Best First'.
Re^2: Prototyping - is it necessary?
by bioMan (Beadle) on Sep 01, 2005 at 19:49 UTC

    Yes, I caught that bug after my post. Originally I had a statement before

    (my $datafile, $chomp) = @_;

    That read,

    my $chomp = 0;

    ... but I removed it knowing that if I could remove the prototyping and only pass in a value for $datafile then $chomp would automatically be set to undef. I forgot to move "my" outside the parentheses. Poof! a bug!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://488255]
LanX sighs ... no idea stupid enough
[choroba]: "Smack My Bitch Up" did, though
[Eily]: that's the internet for you LanX
[Eily]: and I'm pretty sure there's a rule somewhere that states that the stupider the idea, the more likely it is to already have been done
zentara is thinking of moving to Mars to esacpe it all
[LanX]: Zentara eq Dr Manhatten ?
[zentara]: more like Dr. Helion3 :-)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2017-03-27 15:23 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.