Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^4: php to perl

by Anonymous Monk
on Jul 06, 2011 at 01:46 UTC ( #912899=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hello is possible to convert php to perl script ?
<?php $foo = "My number is 123456"; $num = preg_replace('/(\W|\D)/e', '',$foo); echo $num; ?>
thanks you

Replies are listed 'Best First'.
Re^5: php to perl
by wazoox (Prior) on Jul 07, 2011 at 11:24 UTC
    Very easily.
    $foo = "My number is 123456"; $num = $foo; $num =~ s/(\W|\D)//g; print $num;
      very good

      thanks you

      for reponse :-)

      best regards

Re^5: php to perl
by Anonymous Monk on Jul 07, 2011 at 05:00 UTC
    Yes. What does it do? Does it operate on $foo?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://912899]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2021-04-11 15:07 GMT
Find Nodes?
    Voting Booth?

    No recent polls found