perl - Efficient way to check if elements of an array is a substring of elements in another array -


i have 2 arrays:

  1. @array1 contains blah1 through blah100.
  2. @array2 contains name: creating "blah1" through name: creating "blah100".

i need check each element @array1 in @array2 name: creating part getting in way.

what best route make sure elements @array1 in @array2?

maybe use of regexes matching while looping through @array1 against @array2?
there faster way?

do array_diff, intersect, or unique work when there noisy string in 1 of arrays?

or

maybe manipulate @array2 gets rid of name: creating part each data?

which way faster?

die if @array1 != @array2; (0..$#array1) {    die if $array2[$_] ne qq{name: creating "$array1[$_]"}; } 

or if name part variable,

die if @array1 != @array2; (0..$#array1) {    die if $array2[$_] !~ /: creating "\q$array1[$_]\e"$/; } 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -