in reply to system() and backticks question

Hmm... The fact that you're using @arr[0] rather than $arr[0] in your question makes me suspect you may not have the hang of arrays and slices (yet).

As others have mentioned, post some code; it's much easier to answer specific questions than general ones.

Replies are listed 'Best First'.
Re: Re: system() and backticks question
by Jerry (Scribe) on Sep 05, 2001 at 21:57 UTC
    As far as my understanding of arrays, scalars and hashes goes, $arr[0] is correct from a syntactical standpoint, but from a functional standpoint @arr[0] seems virtually indentical.

    -Jerry
    http://www.digilliance.net

      I wouldn't make such statements when brother merlyn is around. ;-)

      The difference is a big one. An array slice (which is what @arr[0] is) provides a list context, whereas an array element provides a scalar context. For a graphic illustration, try this code:

      my @d = qw(this is a plain array); my @a; $a[0] = @d; print "The scalar got '$a[0]'\n"; @a[0] = @d; print "But the array slice got '$a[0]'\n";
      Many things in Perl will behave differently in scalar versus list context. If you continue to use @a[0] when you mean $a[0], you will have a surprise one day.

      OTOH, it's your code....