I don't think this is too difficult to explain. The problem lies in the mistake of trying to do an action on one that does not receive such action. They want to split an array. You cannot split an array, an array is already split. You want to split a string. This could have simply been a typo. If they would, for instance, do (under vim) :%s/@argv/$argv/g everything would be okay.
On Sun, Dec 28, 2008 at 12:03 PM, Gabor Szabo <[email protected]> wrote: > > As I am teaching I see beginners make lots of annoying mistakes that > perl does not catch > and is hard to explain. > Eg. What does the following code do and why? > > Gabor > > use strict; > use warnings; > > my @argv = ("abcdXezXq"); > > my @view = split ("X" , @argv ); > print @view; > _______________________________________________ > Perl mailing list > [email protected] > http://perl.org.il/mailman/listinfo/perl _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
