develooper Front page | perl.macperl | Postings from February 2016

$PREMATCH Question

Thread Next
From:
Jonathan Levi via macperl
Date:
February 3, 2016 01:59
Subject:
$PREMATCH Question
Message ID:
152a4db59b0-44de-cc67@webprd-a11.mail.aol.com
Can someone explain why the following:

echo alphabet | perl -e '$_=<STDIN>; if (m/pha/){print $PREMATCH, "\n"}'

yields "" instead of "al", as I expected?

Jonathan

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About