Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2015-11-26 03:36 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls