in reply to Re: array confusion
in thread array confusion

Why use a regexp when you want equality?

if ( grep { $_ eq $system1 } @system_name ) { ...

Going back to the original question: This is a situation where a hash would be more appropriate:

my %system_name = ( box1 => 1, box2 => 1 ); # ... if ( $system_name{$system1} ) { ...
--
edan

Replies are listed 'Best First'.
Re^3: array confusion
by Anonymous Monk on Jul 05, 2004 at 11:00 UTC
    so what is this line doing -er saying
    my %system_name = (box1 => 1, box2 => 1)

      That line is creating an associative array (or hash) with 2 keys, 'box1' and 'box2'. You can then access the elements in the hash with the

      $hash{key}
      syntax. You might want to read perldoc perldata to get an idea of what this all means.

      --
      edan