Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: capturing terminal directory relative path?

by bichonfrise74 (Vicar)
on Mar 07, 2010 at 16:46 UTC ( #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


Comment on Re: capturing terminal directory relative path?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2015-07-07 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls