Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Finding a extention

by Rich36 (Chaplain)
on Oct 05, 2002 at 16:32 UTC ( #203053=note: print w/replies, xml ) Need Help??


in reply to Re: Finding a extention
in thread Finding a extention

You can also use a regex so that you don't have to worry about listing all the possible extensions.

foreach("fp.html", "fp.cgi", "fp.pl", "fp.foo", "fp.blah") { my ($base, $path, $type) = fileparse("/home/users/rich36/$_", qr{\ +..+}); print qq($base, $path, $type\n); } __RESULT__ fp, /home/users/rich36/, .html fp, /home/users/rich36/, .cgi fp, /home/users/rich36/, .pl fp, /home/users/rich36/, .foo fp, /home/users/rich36/, .blah
«Rich36»

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2021-04-14 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?