Can someone explain the first result?

$ perl -wle '$_ = "small - medium - large";
    /- (.+?)$/;   print $1;
    /^(.+?) -/;   print $1;
    /.*- (.+?)$/; print $1'
medium - large
small
large
$

I was expecting just "large" with the non-greedy match. In light of
result #1, I contrived #3, but I'm not completely sure why it's
necessary.

Paul

-- 
Paul Makepeace ....................................... http://paulm.com/

"What is the last man standing? Yoko Ono."
   -- http://paulm.com/toys/surrealism/

Reply via email to