Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: using bits to print part of a string.(bug)

by BrowserUk (Pope)
on Mar 16, 2013 at 04:19 UTC ( #1023809=note: print w/ replies, xml ) Need Help??


in reply to Re^2: using bits to print part of a string
in thread using bits to print part of a string

BTW: There is a problem with your substrwise test.

The first time through, $mask is undefined, so you set up @mask and set smask.

But on the second and subsequent times through, $mask is defined, so the non-state variable: @mask is left empty, so you don't do any actual work.

That probably explains the surprising apparent efficiency of substrwise in the figures McA posted.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re^3: using bits to print part of a string.(bug)
Select or Download Code
Re^4: using bits to print part of a string.(bug)
by McA (Curate) on Mar 16, 2013 at 17:12 UTC

    Aaaarrggghh, and I just started to change every regex substitution in my code to a combination of index and substr to get cutting edge performance... ;-)

    McA

      I just started to change every regex substitution in my code to a combination of index and substr to get cutting edge performance... ;-)

      Now you'll have to change them all to bitwise ops :)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^4: using bits to print part of a string.(bug)
by choroba (Abbot) on Mar 17, 2013 at 08:05 UTC
    Thanks for catching the problem.

    BTW, I had to change the condition in substrref to

    while $mask =~ /1+/g
    to get the same results as from the other methods.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-08-23 00:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (169 votes), past polls