Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^7: When every microsecond counts: Parsing subroutine parameters

by CountZero (Bishop)
on May 18, 2008 at 17:36 UTC ( [id://687226]=note: print w/replies, xml ) Need Help??


in reply to Re^6: When every microsecond counts: Parsing subroutine parameters
in thread When every microsecond counts: Parsing subroutine parameters

I have occasionally desired say $x,,,,$y to be a shortcut for $x,undef,undef,undef,$y.
Be happy that you need the undef! Counting the nothings between the commas must be one of the most frustrating exercises ever devised.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

  • Comment on Re^7: When every microsecond counts: Parsing subroutine parameters
  • Download Code

Replies are listed 'Best First'.
Re^8: When every microsecond counts: Parsing subroutine parameters
by blazar (Canon) on May 19, 2008 at 18:53 UTC

    I personally believe that's why I occasionally desire it, as opposed to constantly.

    Having stared at csv files with empty fields, I know what you mean, except that in that case the task can even be facilitated by the formatting of some fields. However there's a difference between say, fifteen adjacent commas and two or three. Anyway that's not something to be changed, so it's not worth discussing either. OTOH I often feel the need for some syntactical sugar to indicate a "missing something," whereas undef, however short, is somewhat obtrusive: Perl is already a hell to parse, but how 'bout a lonely minus sign?

    my $x = foo(42,-,-,'cool');
    --
    If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-20 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found