I am trying to convert a javascript to perl, a silly little utility for password checking (not that I need it to work, I just want to learn how).
The section of the script that I am having problems with is
y=3710
v=Math.sqrt(y)
v=parseInt(v,16)
The place I'm running into trouble is the
parseInt(v,16) line.
I looked it up on a java script tutorial
site but am having trouble finding a similar function in perl, according to the above link, "The parseInt function parses its first argument, a string, and attempts to return an integer of the specified radix (base)".
Can someone point me to where I might be able to find such a beast in perl? (i.e. a way to get 96 from 60.909769331364245)
My apologies if this question has already been asked, but I was unable to locate information about it from the search box.
Edited by dws for title descriptiveness
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.