Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Perl equivalent of JavaScript parseInt()?

by Anonymous Monk
on Nov 18, 2019 at 19:07 UTC ( [id://11108877]=note: print w/replies, xml ) Need Help??


in reply to Perl equivalent of JavaScript parseInt()?

This should work like the Java ParseInt function:
sub parseInt { my ($parse) = @_; my $new=''; my $newvalue=0; my $leng = length ($parse); $leng --; for (my $i=0; $i <=$leng; $i++) { $new = substr($parse,$i, 1); my $exp = $leng-$i; $newvalue += $new * (16**$exp); } return $newvalue; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11108877]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-20 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found