Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: VVP:Perl oneliners for Unix commands

by petral (Curate)
on Mar 13, 2002 at 19:40 UTC ( [id://151500]=note: print w/replies, xml ) Need Help??


in reply to Re: VVP:Perl oneliners for Unix commands
in thread VVP:Perl oneliners for Unix commands

Right, this will work with the newest perls (>= 5.6), at least if you use glob() instead of <>.   The problem is:
$ ls Hold/* |wc /bin/ksh: /usr/bin/ls: arg list too long 0 0 0 $ ls Hold |wc 169170 169170 2739945 $ perl -lwe'@x=<"Hold/*">;print 0+@x' 0 $ perl -lwe'@x=glob"Hold/*";print 0+@x' 169170 $
Since 5.6 glob does not use a shell to expand filesystem wildcards.

update:   Gah! tye, of course, is right <Hold/*> is the same as glob"Hold/*".   (No '"'s inside <>.)

  p

Replies are listed 'Best First'.
(tye)Re: VVP:Perl oneliners for Unix commands
by tye (Sage) on Mar 14, 2002 at 15:29 UTC

    The following are all the same:

    glob"Hold/*" glob("Hold/*") <Hold/*>
    but <"Hold/*"> is the same as glob('"Hold/*"'), which doesn't do what you want. I expected it to print 1 instead of 0 but it probably notes that there is no file named exactly Hold/* and so returns nothing.

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

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

    No recent polls found