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

Re: Can you make it nicer?

by hdb (Monsignor)
on Nov 19, 2013 at 07:46 UTC ( #1063291=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub id2path_new {
        my $id = shift or return q();
        return sprintf "%03d/$2/$3", $1 if $id =~ /(.+)(...)(...)/;
        return join "/", "00000$id" =~ /(..)(..)(..)$/;
    }
    
  2. or download this
    sub id2path_new {
        my $id = shift or return q();
        $id =~ /(.+)(...)(...)/ or "00000$id" =~ /(..)(..)(..)$/;
        return sprintf "%0".length($3)."d/$2/$3", $1;
    }
    
  3. or download this
    sub id2path_new {
        my $id = shift or return q();
        sprintf "%0".($id=~/(.+)(...)(...)/?3:("00000$id"=~/(..)(..)(..)$/
    +,2))."d/$2/$3",$1;
    }
    
  4. or download this
    sub id2path_new {
        $_[0]?join"/",grep{$_}"00000$_[0]"=~/0*(..)(..)(..)$|0*(.{3,})(...
    +)(...)$/:q();
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1063291]
help
Chatterbox?
[thezip]: Apparently I have already reached my destination...
[erix]: pianola's :P
[oiskuu]: Prepare your piano with tuna and your cat will show you some love.
thezip has a sudden compusion to dance the tango...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2017-11-17 19:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?