Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: path is broken

by kilinrax (Deacon)
on Dec 07, 2000 at 16:53 UTC ( #45491=note: print w/replies, xml ) Need Help??


in reply to Re: Re: path is broken
in thread path is broken

I assume that what you're looking for here is the string '/org/trans/program files/dir1/subdir1/subdir2/file1.cpp'.
Crafting a regex to extract the file name without having a format you can rely on is going to be tricky.
However, if you are always going to be looking for a '.cpp' file, then the following will work:
#!/usr/bin/perl -w use strict; my $data = join '', <DATA>; my ($filename) = ($data =~ m|^Module: (.*\.cpp)$|ms); $filename =~ s|\n||; print $filename; __DATA__ Module: /org/trans/program files/dir1/subdir1/subdir2/file1.cpp some flags some history

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-05-25 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?