Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
There's more than one way to do things
 
PerlMonks  

Re: precedence: two functions on one line

by bwana147 (Pilgrim)
on Jul 27, 2001 at 14:38 UTC ( [id://100316]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to precedence: two functions on one line

Parentheses are mostly harmless, so you should use them when in doubt, or even when not in doubt, just to make things plain and visible.

Now, as for your problem:

$path = "/usr/local/bin/foobar/"; @file = map { "$path/$_.html" } qw/ a b c d e f /;

--bwana147

Replies are listed 'Best First'.
Re: Re: precedence: two functions on one line
by kingman (Scribe) on Jul 27, 2001 at 14:59 UTC
    I can't change the data as this is part of a larger application that expects $tracker to be a scalar. However, This variation on what you posted does exactly what I want, and on a single line too!
    @files = map { "$path$_" } split /<br>\n/, $tracker;
    Must go meditate on the mysteries of the map function. Thanks!
      map's great. Here's another example, to aid the old meditations:
      $tracker = join "", map {"$_.html<br>\n"} ('a'..'f');
      - although frankly it's more readable as a here doc!

      andy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://100316]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.