in reply to Prototyping - is it necessary?

I want $chomp to be an optional parameter with a default value of undef, but prototyping forces me to explicitly include a value for $chomp whenever I call getFileData.

The correct prototype is ($;$).

However, the code you posted doesn't even compile. Did you commit the sin of re-typing rather than copy-and-pasting?

Replies are listed 'Best First'.
Re^2: pennance (OT)
by MidLifeXis (Monsignor) on Sep 01, 2005 at 10:51 UTC

    Did you commit the sin of re-typing rather than copy-and-pasting?

    Does this mean that the OP needs to do some "hail Larrys"?

    Update: Added original quote for context.

    --MidLifeXis

      No, I did a cut and paste, but as pointed out in another post I have another bug.

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

      throws an error because $chomp isn't explicitly declared/scoped and strict pitches a fit, "my" should be outside the parentheses.

        That's not "another" bug, that's the bug that led me to suspect foul play.

        See, either (1) you posted code you knew didn't compile; (2) you posted code you hadn't even tried to run; or (3) you posted code that wasn't the same as what you were running.

        I was guessing #3 a few nodes up the thread, since it's perhaps the least egregious.