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

Re: Using split

by robartes (Priest)
on Mar 07, 2003 at 09:03 UTC ( [id://241090]=note: print w/replies, xml ) Need Help??


in reply to Using split

pop expects an array, whereas split returns a list. This is one of those cases where the difference between arrays (which can have elements popped off) and lists (which can't) is important. You could use some syntactic sugar to transform the list into an anonymous array, as in:
$ perl -e 'print pop @{[split m|/|, "/home/bin/scripts/test.pl"]};' test.pl $

Update: Changed example to OP's example.

CU
Robartes-

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-24 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found