in reply to Re^2: appending multiple values in an array
in thread appending multiple values in an array

im very new to perl, so if i store split( />/, $reqd_2 ) into a $variable and then give push ($variable, @array) inside the for loop, it should work??
  • Comment on Re^3: appending multiple values in an array

Replies are listed 'Best First'.
Re^4: appending multiple values in an array
by kyle (Abbot) on Mar 18, 2009 at 15:14 UTC

    If you store the result of split into a scalar variable like $variable, it will be the number of fields that would have been returned if you'd used an array instead. As such, you probably want to set "@variable = split />/, $reqd_2" instead.

    The documentation for push has a better explanation for how to use it than I could supply. For your simple example, I'd write "push @array, $variable".