Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 studying the Monastery: (7)
As of 2015-07-02 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (28 votes), past polls