in reply to Matching Text Regular Expression.

First off, the pipe character is special in regular expressions so you need to escape it \|, second, your regular expression REQUIRES a pipe to be in the match... third you only allow one character after the pipe...

It works better like this

my @cities = $test =~ m/^'([^'|]+)/gm;
the m modifier means match ^ to the beginning of any line, not just the string. So it matches a single quote at the front of a line and captures all characters after it that are not a pipe or a single quote.

                - Ant
                - Some of my best work - (1 2 3)