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

Re: Re: Re: Re:{2} Getting impossible things right (behaviour of keys)

by blakem (Monsignor)
on Oct 24, 2001 at 21:44 UTC ( #121211=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re:{2} Getting impossible things right (behaviour of keys)
in thread Getting impossible things right (behaviour of keys)

Good, point... the entire sort is unnecessary. The length is taken care of by the regex engine, and its not possible to have two matches of the same length, so no sorting all all is needed. Therefore, I submit that:
my $pattern = join('|',(keys %sufdata)); if ($name =~ s/($pattern)$/$sufdata{$1}/o) { print "Suffix $1 -> $name\n"; return; } print " no rule apply -> $name\n";
Would work the same as my code above.

-Blake

  • Comment on Re: Re: Re: Re:{2} Getting impossible things right (behaviour of keys)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://121211]
help
Chatterbox?
[Discipulus]: ah! ++choroba for seek $FH, $. = 0, 0;
[Discipulus]: anyway I lost 15 minutes with lc $str used by me instead of $str = lc $str

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-06-26 11:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (577 votes). Check out past polls.