Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Answer: How to extract the substring from a delimiter (dot) to end of string?

( #10639=categorized answer: print w/ replies, xml ) Need Help??

Q&A > data formatting > How to extract the substring from a delimiter (dot) to end of string? contributed by ZZamboni

In the spirit of TIMTOWTDI, you could also do:

( $extension ) = $string =~ /([^.]*)$/;

The above will give you the whole string if it does not contain any dots. If you want the result to be undef if there are no dots, you could use:

( $extension ) = $string =~ /\.([^.]*)$/;

Comment on Answer: How to extract the substring from a delimiter (dot) to end of string?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2016-02-08 06:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (268 votes), past polls