Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Commonly accepted style guide?

by Anonymous Monk
on Sep 26, 2005 at 09:25 UTC ( #495039=note: print w/replies, xml ) Need Help??


in reply to Re: Commonly accepted style guide?
in thread Commonly accepted style guide?

If I see @n[$i] I get very worried.

I don't. It's about time we got rid of that warning. It's going to be the right syntax in perl6, it's doing the right thing in perl5, and considering that:

@n[$i,$j,$k,$l] @n[$i,$j,$k] @n[$i,$j]
return 4, 3, and 2 element slices - the use of @n[$i] isn't unnatural at all. Its a one element slice. And what does a slice in scalar context return? It's last element. Which, obviously, is $n[$i].

So, I think in this case that Perl should act perlish, and shut up and DWIM (which it is doing already). And not whine and pretent to be Java or Python.

Replies are listed 'Best First'.
Re^3: Commonly accepted style guide?
by sauoq (Abbot) on Sep 26, 2005 at 10:39 UTC
    I don't.

    Perhaps you should. Here's one example (paraphrased from real life) of how it can get ugly...

    #!/usr/bin/perl $\=$/; @n[0] = localtime; $n[1] = localtime; print for @n;

    -sauoq
    "My two cents aren't worth a dime.";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2016-12-05 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (71 votes). Check out past polls.