in reply to Removing File Extensions
use File::Basename; my @files = ("one.zip","twotwo.doc","three3.ppt"); my @onlyNames; my @onlyExt; foreach my $file (@files) { my ($name, $path, $suffix) = fileparse( $file, qr/\.[^.]+$/ ); $suffix =~ s/\.//; push @onlyNames, $name; push @onlyExt, $suffix; }
Update: Fixed typo. (Thanks, Not_a_Number!)
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Removing File Extensions
by tkil (Monk) on May 02, 2004 at 02:36 UTC | |
by dragonchild (Archbishop) on May 02, 2004 at 02:49 UTC | |
by tkil (Monk) on May 02, 2004 at 03:09 UTC | |
by dragonchild (Archbishop) on May 02, 2004 at 15:54 UTC | |
by tkil (Monk) on May 02, 2004 at 18:29 UTC | |
|