Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Slow Regex - How to Optimize

by InfiniteSilence (Curate)
on Aug 30, 2005 at 22:22 UTC ( #487970=note: print w/ replies, xml ) Need Help??


in reply to Slow Regex - How to Optimize

If I am not mistaken, this can be rewritten as:

#!/usr/bin/perl -w use strict; my ($wholefile); my (@keys, %SUBS); $SUBS{'b'} = 1; $SUBS{'c'} = 1; local $/; open(H,qq|$ARGV[0]|) or die "USAGE: wierd2.pl <filename>"; #sloppy exa +mple $wholefile .= <H>; close(H); foreach (keys %SUBS) { while($wholefile=~m/\b$_\b/g){ push @keys, $_; } } 1;
Of course, I have no idea how:
  • You are getting the %SUBS hash populated in the first place. I thought that was the purpose of the script?
  • Why you would want to do this

    Celebrate Intellectual Diversity


  • Comment on Re: Slow Regex - How to Optimize
    Download Code

    Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2014-09-24 04:58 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (246 votes), past polls