Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

Comment on Re^4: php to perl
Download Code
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?
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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-10-31 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (225 votes), past polls