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

Re: extract file name from path

by Laurent_R (Abbot)
on Sep 11, 2013 at 16:52 UTC ( #1053526=note: print w/replies, xml ) Need Help??

in reply to extract file name from path

What about this:

my $id = $1 if $line =~ /(\w+)\.java\s/;

Replies are listed 'Best First'.
Re^2: extract file name from path
by Anonymous Monk on Sep 11, 2013 at 17:00 UTC
    Nope did not help.

      I posted it without being able to test. Now I am back home and can test, and it works for me as shown in this session under the Perl debugger:

      DB<1> $line = 'root 30145 1 0 Jan30 ? 00:09:01 /root/java/app/java_a --javaproc'; DB<2> $id = $1 if $line =~ /(\w+)\.java\s/; DB<3> print $id; java_app_1Rule_java_app_2Rule

      And, BTW, I don 't see why I received a downvote for a solution that works.

        Sorry Buddy.... It worked!!!! My apologies!!!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053526]
[ambrus]: Corion: I didn't want to start this particular computer up, I took this one away so that I can put the other computer I want to start up in its place, but that probably doesn't make much of a difference.
[Corion]: ambrus: A sacrifice is a sacrifice ;)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2017-01-16 19:54 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.