Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How's My Style Now?

by juster (Friar)
on Feb 06, 2010 at 18:54 UTC ( [id://821769]=note: print w/replies, xml ) Need Help??


in reply to How's My Style Now?

You don't need to prefix subroutine calls with &. Thats a throwback from perl 4 like 10 years ago? I dunno for sure, sometimes I see it. Its ugly and extra work anyways!.

Nested dereferencing "arrows" (->) can be ommitted. I'm not sure how best to describe it, but here is the before:

my $category = lc($musing_cats->{$ref_id}->{'ref_name'});

After:

my $category = lc $musing_cats->{$ref_id}{'ref_name'};

Replies are listed 'Best First'.
Re^2: How's My Style Now?
by FunkyMonk (Chancellor) on Feb 06, 2010 at 22:23 UTC
    Thats a throwback from perl 4 like 10 years ago
    And then some! From perlhist:

    Larry 5.000 1994-Oct-17
Re^2: How's My Style Now?
by Spenser (Friar) on Feb 08, 2010 at 15:05 UTC
    Yes, cjcollier has told me about this habit I have of prefixing sub-routine calls with an ampersand. It may not be deprecated, but it is somewhat self-deprecating on my part to use them. Like the Anonymous poster here, I find it easier visually to locate them. However, it is suggesting that my functions are of a lesser grade and it's unnecessary formatting. Alright, I'll stop using that.

    -Spenser

    That's Spenser, with an "s" like the detective.

Re^2: How's My Style Now?
by Anonymous Monk on Feb 08, 2010 at 14:34 UTC
    I like &'s for readability. They aren't deprecated, and easy to jump to when using vi.

      ... and they have unwanted side effects, like overriding prototypes. Bad idea.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found