Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Practical example of "Is Perl code maintainable"

by Fletch (Chancellor)
on Aug 13, 2007 at 13:02 UTC ( #632201=note: print w/replies, xml ) Need Help??

in reply to Practical example of "Is Perl code maintainable"

What jumps out at me is the use of $dummy rather than undef as the placeholder for value-to-discard-in-list-assignment, especially since this very function (stat) is used in the example of doing so in List value constructors list . . .

Replies are listed 'Best First'.
Re^2: Practical example of "Is Perl code maintainable"
by jhourcle (Prior) on Aug 13, 2007 at 14:28 UTC

    I've seen valid reasons for using '$dummy' rather than 'undef', but not in this example.

    I can't remember if it was specifically a MacPerl thing, but there were some older versions where you couldn't cast undef with my, so when I'd be working with tab delim files, I'd do stuff like:

        my ($foo, $bar, $undef, $undef, $baz) = split (/\t/, $line);

    As the following would throw errors:

        my ($foo, $bar, undef, undef, $baz) = split (/\t/, $line);

    It's not a problem any longer, and the example given declares the variables in the lines before, so it wouldn't have been an issue. I'd assume that either the person was learning perl by looking at other people's old code, or had learned a while back, and hadn't kept up with the changes in the language.

Re^2: Practical example of "Is Perl code maintainable"
by moritz (Cardinal) on Aug 13, 2007 at 13:42 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://632201]
[Your Mother]: Liquore Strega. :P
[shmem]: s/beans of coffee/enterprise beans/ :-P
[erix]: Take your bottles -- you're all invited! :)
[panwarsagar]: I have started learning Perl and my moto is to process a text file and storing the contents in a Data Base

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-03-28 12:25 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (330 votes). Check out past polls.