|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re: Parse out the extension of a filename - return base of filename.by rob_au (Abbot) |
| on Mar 12, 2002 at 18:45 UTC ( [id://151268]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
While I do admire your industrial spirit, you can already do this with File::Basename ...
The key to this working is the regular expression passed to the fileparse method - The regular expression in the example above matches the suffix of a file as being the last dot and what follows it, excluding any subsequent dots ([^\.]).
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
In Section
Cool Uses for Perl
|
|
||||||||||||||||||||||||||||||||||