Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Can you make it nicer?

by choroba (Canon)
on Nov 18, 2013 at 21:18 UTC ( #1063201=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub id2path {
        my $id = shift;
    ...
        }
        return $path;
    }
    
  2. or download this
    sub id2path_new {
        my $id = shift or return q();
    ...
        my $path  = join '/', $id =~ / ^ (.*) ($chunk) ($chunk) $ /xg;
        return $path;
    }
    
  3. or download this
    use Test::More tests => 23;
    is(id2path_new($_), id2path($_), "id=$_") for q(), 0, 1, 9, 10, 99,
    ...
                                              99999, 100000, 999999, 1e6,
                                              1e7-1, 1e7, 1e8-1, 1e8, 1e9,
                                              1e10, 1e11, 1e12;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1063201]
Front-paged by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2015-07-05 04:10 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 (60 votes), past polls