Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Is there a better way to get the Country names with help of Regax

by 2teez (Priest)
on Oct 16, 2012 at 09:23 UTC ( #999268=note: print w/replies, xml ) Need Help??

in reply to Is there a better way to get the Country names with help of Regax

Hi, You could use this

print $1, $/ if ( $location =~ m{(?<=:)(?:.-)?(.+?)$} );
even addressing the excellent point raised by tobyink
like so:
#!/usr/bin/perl use warnings; use strict; while ( defined( my $location = <DATA> ) ) { chomp $location; print $1, $/ if ( $location =~ m{(?<=:)(?:.-)?(.+?)$} ); } __DATA__ $names = Location:G-Canada $names = Location:Germany $names = Location:p-Australia $names = Location:e-Britain $names = Location:USA $names = Location:c-India $names = Location:Netherlands $names = Location:r-China $names = Location:North Korea $names = Location:Vatican City $names = Location:South Sudan $names = Location:Timor Leste $names = Location:Papua New Guinea
Canada Germany Australia Britain USA India Netherlands China North Korea Vatican City South Sudan Timor Leste Papua New Guinea

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999268]
[pryrt]: stevieb: going thru cblast to get caught up, I see that strawberry fixed their download hashes. Fast turnaround on that fix. :-)
[pryrt]: Are you going to tie the berrybrew expected hashes to their releases.json to keep it always up-to-date?

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-03-30 13:11 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (357 votes). Check out past polls.