in reply to Array or Hash problem!

I don't understand this chunk of code at all:
if ( "@code_array" =~ /(^|\s|[:alpha:]{0,3})$accountnumber(\s|
+$)/
Show your initial data, db data and which result you seek and i can tell you, how you can improve and finish your program. P.S. to receive hash from array you need: %hash = @array, it simple ;-)

Replies are listed 'Best First'.
Re^2: Array or Hash problem!
by Anonymous Monk on Mar 04, 2010 at 18:04 UTC
    I am just searching the array without the use of a loop.
      Searching array without loop in Perl - is "grep" or "~~" Show some data please.
        OK here is a sample of what that does:
        #!/usr/bin/perl -w my @code_array = qw(7772344 2233421 TMW2222987 TMA2222333 TMW9999988 A +MQ8873332 AMQ1111877); #the 2222987 value will be coming from the db query if ( "@code_array" =~ /(^|\s|[[:alpha:]]{0,3})2222987(\s|$)/ ) { print "Match!! \n"; } else { print "No Match \n"; }

        I hope I made it a little clear now!