Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: capturing terminal directory relative path?

by bichonfrise74 (Vicar)
on Mar 07, 2010 at 16:46 UTC ( [id://827254]=note: print w/replies, xml ) Need Help??


in reply to capturing terminal directory relative path?

I agree that File::Basename is the robust way to do what you need. But maybe the below code is something you might want to consider as well.
#!/usr/bin/perl use strict; while (<DATA>) { print + (split( /\// ))[-1] if /\d+/; } __DATA__ /home/BORK/work/test-backfills/cp_test /home/BORK/work/test-backfills/cp_test/82468 /home/BORK/work/test-backfills/cp_test /home/BORK/work/test-backfills/cp_test/82480 /home/BORK/work/test-backfills/cp_test /home/BORK/work/test-backfills/cp_test/82485 /home/BORK/work/test-backfills/cp_test /home/BORK/work/test-backfills/cp_test/82490 /home/BORK/work/test-backfills/cp_test /home/BORK/work/test-backfills/cp_test/82767 /home/BORK/work/test-backfills/cp_test /home/BORK/work/test-backfills/cp_test/82802 /home/BORK/work/test-backfills/cp_test

Log In?
Username:
Password:

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

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

    No recent polls found