Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Extracting just the extension from a filename.

by simeon2000 (Monk)
on Jul 19, 2002 at 20:18 UTC ( [id://183438]=note: print w/replies, xml ) Need Help??


in reply to Re: Extracting just the extension from a filename.
in thread Extracting just the extension from a filename.

Good solution. My only additions would be to use \^\.\ instead of \w to catch \W as well but not ".".

You could also one-line it by catching the matches with alist assignment to avoid reading from $1:

my ($extension) = $filename =~ /\.([^\.]+)$/;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://183438]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-25 19:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found