HI,

I have a question.
I want to extract all the information to the left of the last comma.
If there are 3 commas I would like everything to the left of the third comma.

$derer  = "Seattle, Washington, USA, NAME";   ## I only need Seattle,
Washington, USA

if($derer =~ /(.*?),([.*?,]*)(.*)/g) {             ## I figure Seattle is $1
Washington is $2 and USA is $3
                                   ## I put ([.*?,]*) to tag if there is
otherinformation and commas, as many times
                                   ## following the first one. This should be
$2.
        print " \$1 = $1, \$2 = $2, \$3 = $3 \n";       ##  $1 is Seattle $2
is
blank  $3 is Washington, USA

        $Source = $1 . " ". $2 ;
}
print "source = $Source \n";                  ## Prints source = Seattle


What am I doing wrong?
Why is $2 blank?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to