in reply to Parse out the extension of a filename - return base of filename.
While I do admire your industrial spirit, you can already do this with File::Basename ...
use File::Basename; my $fname = "/usr/local/isp/system.update.perl"; my ($name, $path, $suffix) = fileparse($fname, '\.[^\.]*'); print STDOUT $name, "\n";
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'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parse out the extension of a filename - return base of filename.
by freonpsandoz (Beadle) on Sep 20, 2016 at 22:26 UTC | |
|
Re: Re: Parse out the extension of a filename - return base of filename.
by snafu (Chaplain) on Mar 13, 2002 at 12:39 UTC | |
by knobunc (Pilgrim) on Mar 13, 2002 at 14:43 UTC | |
by snafu (Chaplain) on Mar 13, 2002 at 14:47 UTC |