Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Shortening "$bar{foo} if exists $bar{foo}"?

by Aristotle (Chancellor)
on Oct 03, 2003 at 22:42 UTC ( [id://296420]=note: print w/replies, xml ) Need Help??


in reply to Shortening "$bar{foo} if exists $bar{foo}"?

I've been bothered by code duplication when using exists many a time. Unfortunately, I've never ever found a satisfactory solution (and believe me, it's not for lack of trying).

Makeshifts last the longest.

  • Comment on Re: Shortening "$bar{foo} if exists $bar{foo}"?

Replies are listed 'Best First'.
Re: Re: Shortening "$bar{foo} if exists $bar{foo}"?
by kelan (Deacon) on Oct 04, 2003 at 17:15 UTC

    How about this Perl6-ish way:

    given %foo{bar} { .() if exists }
    It's still about as much typing, though.

    kelan


    Perl6 Grammar Student

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-25 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found