Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: I think regex Should Help Here... but How!?

by RichardK (Priest)
on Feb 15, 2014 at 12:30 UTC ( #1075044=note: print w/ replies, xml ) Need Help??


in reply to I think regex Should Help Here... but How!?

As you're only trying to match the beginning of a string with no wildcards using index seems like a simpler approach.

foreach (@items) { say "$_ match" if index($_,$master) == 0; }


Comment on Re: I think regex Should Help Here... but How!?
Download Code
Re^2: I think regex Should Help Here... but How!?
by AnomalousMonk (Abbot) on Feb 15, 2014 at 13:00 UTC

    This from ozboomer's OP

    if ($str =~ /^$buf/i) { ... }
    indicates a case-insensitive match is required, so index would not be appropriate.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2014-09-23 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (210 votes), past polls