[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT programming languages/ systems for advanced applications on Linux



On Sun, Dec 25, 2011 at 12:42 AM, Vincent Lefevre <vincent@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 <vincent@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-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: [🔎] 20111224164221.GB5641@xvii.vinc17.org">http://lists.debian.org/[🔎] 20111224164221.GB5641@xvii.vinc17.org
>


Reply to: