Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: $str to %hash to @ary

by ccn (Vicar)
on Jul 24, 2004 at 16:20 UTC ( [id://377137]=note: print w/replies, xml ) Need Help??


in reply to Re^2: $str to %hash to @ary
in thread $str to %hash to @ary

nice test
you may try also this one:

ccn_fast => sub { my $rand = rand 100; my $mystr = $str; # this line is needed for repetitive test on +ly 1 while $mystr =~ /([^:]+):([^:]+):?/g and (($rand -= $1) > 0) +; $2; },

Replies are listed 'Best First'.
Re^4: $str to %hash to @ary
by fizbin (Chaplain) on Jul 25, 2004 at 03:11 UTC
    Nice (see my reply to Lymbic~Region); that's fast. In multiple trials, it gets even faster (by ~ 20%) if you don't use a separate variable but instead reset pos($str)
    -- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/

Log In?
Username:
Password:

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

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

    No recent polls found