Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > [FR/EN] faire un tableau / to make a table

Reply
Thread Tools

[FR/EN] faire un tableau / to make a table

 
 
George
Guest
Posts: n/a
 
      09-08-2005
A. Sinan Unur wrote:

> "George" <(E-Mail Removed)> wrote in newsn0e6ysfg39enkw002
> @news.europe.nokia.com:
>
> > Josef Moellers wrote:
> >
> >> George wrote:
> >> > Alextophi wrote:
> >> >
> >> >
> >> > > FR ----------------------------------------------
> >> > > Bonjour
> >> > >
> >> > > Comment faire un tableau avec 1 'cli' avec 2 valeurs.
> >> > >
> >> > > ex: {cli} = (valueA, valueB)
> >> > >
> >> > >
> >> > > EN ----------------------------------------------
> >> > > Hello
> >> > >
> >> > > How to make a table with 1 'key' with 2 values.
> >> > >
> >> > > ex : {key} = (valueA, valueB)
> >> > >
> >> > >
> >> > > regard
> >> > >
> >> > > ch.
> >> >
> >> >
> >> > @{$key}=("value1","value2")
> >>
> >> use warnings; use strict;
> >> @{$key}=("value1","value2")
> >>
> >> Global symbol "$key" requires explicit package name at - line 2.
> >> Execution of - aborted due to compilation errors.

> >
> > should I also tell him to install perl,dumb head

>
> No, but you should realize you are in no position to hurl insults at
> people, let alone give advice.
>
> I presume you meant to use a hash slice above. But even with a hash
> slice, you get the following:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my %hash;
> @hash{key} = ('value1', 'value2');
>
> use Data:umper;
> print Dumper \%hash;
>
> __END__
>
> D:\Home\asu1\UseNet\clpmisc> z
> Scalar value @hash{key} better written as $hash{key} at D:\Home\asu1
> \UseNet\clpmisc\z.pl line 7.
> $VAR1 = {
> 'key' => 'value1'
> };
>
> To have a hash element refer to more than one element, you need to
> set $hash{key} to an array reference:
>
> $hash{key} = ['value1', 'value2'];
>
> Oh, by the way PLONK
>
> Sinan


what are you trying to say by these lines
> Oh, by the way PLONK

 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      09-08-2005
"George" <(E-Mail Removed)> wrote:

> what are you trying to say by these lines


>> Oh, by the way PLONK


That he has configured his news reader to hide all messages written by you
in this group ( and maybe others as well) from now on. (Hence I answer,
because he isn't going to )

I am sure there was a good reason, which might mean others have done the
same. It also might mean that next time you post a question here you get
not as much replies as expected.

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
 
 
 
Josef Moellers
Guest
Posts: n/a
 
      09-08-2005
George wrote:
> Josef Moellers wrote:
>
>
>>George wrote:
>>
>>>Josef Moellers wrote:
>>>
>>>
>>>
>>>>George wrote:
>>>>
>>>>
>>>>>Alextophi wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>FR ----------------------------------------------
>>>>>>Bonjour
>>>>>>
>>>>>>Comment faire un tableau avec 1 'clé' avec 2 valeurs.
>>>>>>
>>>>>>ex: {clé} = (valueA, valueB)
>>>>>>
>>>>>>
>>>>>>EN ----------------------------------------------
>>>>>>Hello
>>>>>>
>>>>>>How to make a table with 1 'key' with 2 values.
>>>>>>
>>>>>>ex : {key} = (valueA, valueB)
>>>>>>
>>>>>>
>>>>>>regard
>>>>>>
>>>>>>ch.
>>>>>
>>>>>
>>>>>@{$key}=("value1","value2")
>>>>
>>>>use warnings; use strict;
>>>>@{$key}=("value1","value2")
>>>>
>>>>Global symbol "$key" requires explicit package name at - line 2.
>>>>Execution of - aborted due to compilation errors.
>>>
>>>
>>>should I also tell him to install perl,dumb head

>>
>>I always put my name on a separate line, but then ...
>>
>>Your solution does not pass the "use strict", which is sort of a
>>prerequisite for proper solutions.
>>
>>Stay cool,
>>
>>Josef

>
>
> I never wanted to give the complete code, and why should I


You don't have to post "complete code", at least, I didn't.
However, you posted a bad example as it manipulates the symbol table.
The reference to @{...} is considered bad code and "use strict" is there
to catch these. Uncounted replies have pointed out that using a hash is
The Right Thing to do.

> , I answered
> what I though OP asked, Paul Lalli pointed that out that mistake,
> people many sometime just point towards documentation should OP cut and
> paste those lines in perl code and compile them as it is?


Sorry, but I can't quite parse this.

If a question is answered by one of the articles in the FAQ or
documentation, then pointing people at the FAQ list is OK. IMHO, if
answering the question requires less keystrokes than pointing at the
FAQ, then I do prefer that.
When I post a code snipped, I try to adhere to posting rules in that the
code posted should pass
use warnings;
use strict;
and, if possible, it should have been tested (putting them within
<untested>, </untested> might be OK in some circumstances).
If I correct someone's code snippets, then, yes, the OP should be able
to cut-and-paste the correction. In this case, as the question was about
a technique, rather than a non-working code (Alextophi didn't post any
code that is proper Perl), no cut-and-paste solution could be given.

But I stand by my statement that the code line you provided does not
pass "use strict" and, as such, does not adhere to posting rules here.

Your attitude ("dumb head", "why should I") strikes me as being
impolite, but that is my very personal feeling and others might regard
you as being nice and considerate (as it appears, some do not).

This now has little to do with Perl any more, so I think we should close
this debate here.

Josef
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

 
Reply With Quote
 
George
Guest
Posts: n/a
 
      09-08-2005
Josef Moellers wrote:

> George wrote:
> > Josef Moellers wrote:
> >
> >
> > > George wrote:
> > >
> > > > Josef Moellers wrote:
> > > >
> > > >
> > > >
> > > > > George wrote:
> > > > >
> > > > >
> > > > > > Alextophi wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > FR ----------------------------------------------
> > > > > > > Bonjour
> > > > > > >
> > > > > > > Comment faire un tableau avec 1 'clé' avec 2 valeurs.
> > > > > > >
> > > > > > > ex: {clé} = (valueA, valueB)
> > > > > > >
> > > > > > >
> > > > > > > EN ----------------------------------------------
> > > > > > > Hello
> > > > > > >
> > > > > > > How to make a table with 1 'key' with 2 values.
> > > > > > >
> > > > > > > ex : {key} = (valueA, valueB)
> > > > > > >
> > > > > > >
> > > > > > > regard
> > > > > > >
> > > > > > > ch.
> > > > > >
> > > > > >
> > > > > > @{$key}=("value1","value2")
> > > > >
> > > > > use warnings; use strict;
> > > > > @{$key}=("value1","value2")
> > > > >
> > > > > Global symbol "$key" requires explicit package name at - line
> > > > > 2. Execution of - aborted due to compilation errors.
> > > >
> > > >
> > > > should I also tell him to install perl,dumb head
> > >
> > > I always put my name on a separate line, but then ...
> > >
> > > Your solution does not pass the "use strict", which is sort of a
> > > prerequisite for proper solutions.
> > >
> > > Stay cool,
> > >
> > > Josef

> >
> >
> > I never wanted to give the complete code, and why should I

>
> You don't have to post "complete code", at least, I didn't.
> However, you posted a bad example as it manipulates the symbol table.
> The reference to @{...} is considered bad code and "use strict" is
> there to catch these. Uncounted replies have pointed out that using a
> hash is The Right Thing to do.
>
> > , I answered
> > what I though OP asked, Paul Lalli pointed that out that mistake,
> > people many sometime just point towards documentation should OP cut
> > and paste those lines in perl code and compile them as it is?

>
> Sorry, but I can't quite parse this.
>
> If a question is answered by one of the articles in the FAQ or
> documentation, then pointing people at the FAQ list is OK. IMHO, if
> answering the question requires less keystrokes than pointing at the
> FAQ, then I do prefer that.
> When I post a code snipped, I try to adhere to posting rules in that
> the code posted should pass
> use warnings;
> use strict;
> and, if possible, it should have been tested (putting them within
> <untested>, </untested> might be OK in some circumstances).
> If I correct someone's code snippets, then, yes, the OP should be
> able to cut-and-paste the correction. In this case, as the question
> was about a technique, rather than a non-working code (Alextophi
> didn't post any code that is proper Perl), no cut-and-paste solution
> could be given.
>
> But I stand by my statement that the code line you provided does not
> pass "use strict" and, as such, does not adhere to posting rules here.
>
> Your attitude ("dumb head", "why should I") strikes me as being
> impolite, but that is my very personal feeling and others might
> regard you as being nice and considerate (as it appears, some do not).
>
> This now has little to do with Perl any more, so I think we should
> close this debate here.
>
> Josef


I got the point, and so no hard feeling
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vigenere tableau, HOW to generate this algorithm in two dimensional array spidey12345 Java 6 02-08-2007 12:23 PM
insertion du contenu d'un tableau dans une table eXistenZ| ASP General 1 01-24-2005 07:08 AM
Tableau associatif Guy Roydor Javascript 1 02-13-2004 01:02 PM
comment faire une détection de niveau haut ou "1" en vhdl ? Arnaud VHDL 2 02-11-2004 06:34 PM
Calcule l element maximum d'un tableau Vianney =?iso-8859-1?Q?Lan=E7on?= C++ 1 08-29-2003 12:36 AM



Advertisments