I want to split with perl code this type of line:
my $my_town = Madrid(32): Villa de Madrid (ES) Royal Palace of Madrid (Teatro Real)
to:
Madrid(32):
Villa de Madrid (ES)
Royal Palace of Madrid (Teatro Real)
I tried:
my @travel = split(/(?<=\))\s*/, $my_town);
but output result is:
Madrid(32)
: Villa de Madrid (ES)
Royal Palace of Madrid (Teatro Real)
Please give me a little help.
Is there any way that function look-behind for “)” to return all finds fewer first character? “: Villa de Madrid (ES)” without first string “:”, “Royal Palace of Madrid (Teatro Real)” without first string “white space”, …
splitcould do the jobBut since the input doesn’t really look like a uniformly separated list to me, I think it’s the wrong tool for the job. Notice how moving towards a parser is simpler: