On Sun, Dec 25, 2011 at 12:42 AM, Vincent Lefevre <vinc...@vinc17.net> wrote: > On 2011-12-24 23:43:18 +0800, lina wrote: >> Tonight I am pretty free, so started to read something about perl. >> >> #!/usr/bin/perl >> >> print "Hello World! \n"; >> >> $a = 3; >> >> print "$a \n"; >> >> @food = {"apples", "pears", "eels"}; > > I suppose you want: > > @food = ("apples", "pears", "eels"); > > {...} is used for a hash reference, and [...] for an array reference.
Thanks, I was so careless. Did not notice the difference between () and {} in tutorial. (might sit too far away from laptop haha ... if not careless). Best regards, > >> @music = {"whistel", "flute"}; >> >> @moremusic = {"organ", @music, "harp"}; > > Ditto. > >> push(@food, "eggs"); >> >> print @food; >> print "@food"; >> >> I am so CONFUSED why the output is: >> Hello World! >> 3 >> HASH(0x19ec998)eggsHASH(0x19ec998) eggs > > print @food; > > gives > > HASH(0x19ec998)eggs > > (because it contains a hash reference and "eggs"), without a newline. > > print "@food"; > > gives > > HASH(0x19ec998) eggs > > (same thing, but with a space between the elements). > > I suggest that you read more about perl ("man perl" tells you what > you can read...). > > -- > Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/> > 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> > Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon) > > > -- > To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org > Archive: http://lists.debian.org/20111224164221.gb5...@xvii.vinc17.org > -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CAG9cJmø_bzo9oylz52y_2mpiz8cjucydgljxrps2p-fht...@mail.gmail.com