Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: What is the difference between $array[1] and @array[1]?

by Porculus (Hermit)
on Apr 07, 2009 at 20:05 UTC ( [id://756134]=note: print w/replies, xml ) Need Help??


in reply to Re^4: What is the difference between $array[1] and @array[1]?
in thread What is the difference between $array[1] and @array[1]?

The issue is, what do you think when you see @a[4]?

I think, "The person who wrote this can't be very familiar with Perl."

If I myself were not familiar with Perl, I would probably think the something similar to the person who started this thread: "Huh? I thought you had to say $a[4]! What strange magic is this?"

Maybe it would have been better if the language wasn't this way, but it is, and it's best to use it idiomatically and to urge others to do so as well: if you don't, experienced hackers may mistake you for a beginner, and beginners will find your code confusing.

Replies are listed 'Best First'.
Re^6: What is the difference between $array[1] and @array[1]?
by JavaFan (Canon) on Apr 07, 2009 at 21:26 UTC
    I think, "The person who wrote this can't be very familiar with Perl."
    Well, it's more a "nanananana, you expected regularity! Fooled you! Should have used a secret handshake!" unfamiliarity.
    What strange magic is this?
    Why would anyone expect single element lists to have strange magic?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2025-01-15 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (46 votes). Check out past polls.