Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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__ foo.bar.txt goo.doc boo.hoo.moo

prints:

file_no_ext = foo.bar file_no_ext = goo file_no_ext = boo.hoo

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://729487]
help
Chatterbox?
[SwaJime]: Ran into an interesting piece of code today ...
[SwaJime]: select name,status, status2 from __ where status & status < 13 and status2 & 16 <> 16
[SwaJime]: I'm thinking that looks messed up. Sorry for OT ... but I know y'all are smart :-)
[SwaJime]: I expected items to not be selected if status was 0 ... but they were selected
[SwaJime]: any thoughts?

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2017-08-22 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (338 votes). Check out past polls.

    Notices?