Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Regex To Remove File Extension (split)

by toolic (Bishop)
on Dec 10, 2008 at 19:21 UTC ( #729487=note: print w/replies, xml ) Need Help??

in reply to Regex To Remove File Extension

I know your title asks for a regex, but maybe split will do:
use strict; use warnings; while (<DATA>) { chomp; my @parts = split /\./; pop @parts; my $file_no_ext = join '.', @parts; print "file_no_ext = $file_no_ext\n"; } __DATA__ goo.doc boo.hoo.moo


file_no_ext = file_no_ext = goo file_no_ext = boo.hoo