in reply to array confusion

if ( grep (m/^$system1$/ , @system_name)) {
this might help ...

pelagic

Replies are listed 'Best First'.
Re^2: array confusion
by edan (Curate) on Jul 05, 2004 at 10:35 UTC

    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

      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