Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by BrowserUk (Patriarch)
on Mar 16, 2013 at 04:19 UTC ( [id://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.

Replies are listed 'Best First'.
Re^4: using bits to print part of a string.(bug)
by McA (Priest) 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 (Cardinal) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1023809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found