On 10/02/2006 01:54 PM, Rob Dixon wrote:
Bryan R Harris wrote:
**************************************
$ptypeline = "# movable ortProj ortho 0.000 0.000";
($ptype) = ($ptypeline =~ /movable.+(sine|geo|radial|ortho)/i) ||
"(missing)";
print $ptype, "\n";
**************************************
The above code prints "1", where I want it to print "ortho". Is that
possible?
(Preferably in one line, since I'm a *big* fan of perl golf. =)
$ptype = $ptypeline =~ /movable.+(sine|geo|radial|ortho)/i ? $1 :
"(missing)";
Rob
Yes, and here is another way:
$ptype = (($ptypeline =~ /movable.+(sine|geo|radial|ortho)/i)[0]) ||
'(missing)';
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>