in reply to splice question

Short answer: replace @alpha with @array!

Slightly longer but more fundamental answer: always put use strict; at the beginning of your code. OK, this means that you have to change your first line to:

my @array = ('a'..'z');

...but the extra typing pays dividends, since Perl itself would have pointed this error out to you, thus saving you the time it took you to post to perlmonks :-)

dave

Update: BTW, your line $,=''; doesn't actually do anything unless you had previously set $, to something else...

Replies are listed 'Best First'.
Re: Re: splice question
by Roy Johnson (Monsignor) on Nov 06, 2003 at 21:46 UTC
    ...your line $,=''; doesn't actually do anything unless...

    It doesn't do anything in the program, anyway, because he quoted the array. He wants $".

      ...He wants $"

      Sorry, I must be missing something:

      my @array = ('a'..'z'); $" = ''; print "@array";

      What's the point? Just do:

      my @array = ('a'..'z'); print @array;

      Why not set a lot of other special variables to the null string (eg $\ = ''; $/=''; while we're about it? :-)

      dave