Re: printing array elements

2008-10-13 Thread John W. Krahn
Mr. Shawn H. Corey wrote: On Mon, 2008-10-13 at 14:04 +0100, Rob Dixon wrote: A program with arrays that are tied in one place and not in another has bigger problems than this anyway. But I don't see a problem with using $" with tied arrays, unless the tied class happens to overload stringificat

Re: printing array elements

2008-10-13 Thread Mr. Shawn H. Corey
On Mon, 2008-10-13 at 12:15 -0400, Chas. Owens wrote: > But You are typing more. If you were making the claim that > > { > local @" = ", "; > print "buy @a1\nsell @a2\nkeep @a3\n"; > } > > was easier to type than > > print > "buy ", join(', ', @a1), "\n", > "sell ", join(', ',

Re: printing array elements

2008-10-13 Thread Chas. Owens
On Mon, Oct 13, 2008 at 10:50, Rob Dixon <[EMAIL PROTECTED]> wrote: snip > Then we must remain in disagreement. I believe that because > > perldoc perlvar > > is so easy to access, and because it also provides mnemonics for each symbolic > variable, the Huffman encoding principle is paramount here

Re: printing array elements

2008-10-13 Thread Rob Dixon
Jenda Krynicky wrote: > From: Rob Dixon <[EMAIL PROTECTED]> >> Jenda Krynicky wrote: >>> From: "Dr.Ruud" <[EMAIL PROTECTED]> "Jenda Krynicky" schreef: > Rob Dixon: >> >> local $" = ','; >> print "@array\n"; > > print join(',', @array), "\n"; > is much clean

Re: printing array elements

2008-10-13 Thread Rob Dixon
Mr. Shawn H. Corey wrote: > On Mon, 2008-10-13 at 14:04 +0100, Rob Dixon wrote: >> >> A program with arrays that are tied in one place and not in another has >> bigger problems than this anyway. But I don't see a problem with using $" >> with tied arrays, unless the tied class happens to overload

Re: printing array elements

2008-10-13 Thread Jenda Krynicky
From: Rob Dixon <[EMAIL PROTECTED]> > Jenda Krynicky wrote: > > From: "Dr.Ruud" <[EMAIL PROTECTED]> > >> "Jenda Krynicky" schreef: > >>> Rob Dixon: > > local $" = ','; > print "@array\n"; > >>> > >>> print join(',', @array), "\n"; > >>> > >> is much cleaner and safer. Leave $" al

Re: printing array elements

2008-10-13 Thread Mr. Shawn H. Corey
On Mon, 2008-10-13 at 14:04 +0100, Rob Dixon wrote: > A program with arrays that are tied in one place and not in another > has bigger > problems than this anyway. But I don't see a problem with using $" > with tied > arrays, unless the tied class happens to overload stringification. > > print j

Re: printing array elements

2008-10-13 Thread Rob Dixon
Jenda Krynicky wrote: > From: "Dr.Ruud" <[EMAIL PROTECTED]> >> "Jenda Krynicky" schreef: >>> Rob Dixon: local $" = ','; print "@array\n"; >>> >>> print join(',', @array), "\n"; >>> >> is much cleaner and safer. Leave $" alone. >> I don't agree. It is totally fine to use a local-e

Re: printing array elements

2008-10-12 Thread Jenda Krynicky
From: "Dr.Ruud" <[EMAIL PROTECTED]> > "Jenda Krynicky" schreef: > > Rob Dixon: > > >> local $" = ','; > >> print "@array\n"; > > > > print join(',', @array), "\n"; > > > > is much cleaner and safer. Leave $" alone. > > I don't agree. It is totally fine to use a local-ed $", if it is inside >

Re: printing array elements

2008-10-12 Thread Dr.Ruud
"Jenda Krynicky" schreef: > Rob Dixon: >> local $" = ','; >> print "@array\n"; > > print join(',', @array), "\n"; > > is much cleaner and safer. Leave $" alone. I don't agree. It is totally fine to use a local-ed $", if it is inside a minimal block. -- Affijn, Ruud "Gewoon is een tijger."

Re: printing array elements

2008-10-12 Thread Jenda Krynicky
From: Rob Dixon <[EMAIL PROTECTED]> > Charlie Farinella wrote: > > > > I have a string of text that I want to split on the tabs: > > > > while () { > > my @array = split(/\t/, $_); > > > > ...manipulate them a little, and print them back out like so: > > > > print "$array[0],$array[1],$a

Re: printing array elements

2008-10-10 Thread Dr.Ruud
Rob Dixon schreef: > print "@array\n"; > > will output the elements separated with spaces by default. To change > the separator to a comma you can write > > local $" = ','; > print "@array\n"; Please present code like that with enclosing curlies, to limit the scope of the local $". -- Aff

Re: printing array elements

2008-10-09 Thread Mr. Shawn H. Corey
On Thu, 2008-10-09 at 16:53 -0400, Charlie Farinella wrote: > I have a string of text that I want to split on the tabs: > > while () { > my @array = split(/\t/, $_); > > ...manipulate them a little, and print them back out like so: > > print "$array[0],$array[1],$array[2]"; etc. > } > >

Re: printing array elements

2008-10-09 Thread John W. Krahn
Charlie Farinella wrote: I have a string of text that I want to split on the tabs: while () { my @array = split(/\t/, $_); ...manipulate them a little, and print them back out like so: print "$array[0],$array[1],$array[2]"; etc. } I normally just print them as above, but I'm thinking

Re: printing array elements

2008-10-09 Thread Rob Dixon
Charlie Farinella wrote: > > I have a string of text that I want to split on the tabs: > > while () { > my @array = split(/\t/, $_); > > ...manipulate them a little, and print them back out like so: > > print "$array[0],$array[1],$array[2]"; etc. > } > > I normally just print them as ab

Re: printing array elements

2008-10-09 Thread Charlie Farinella
On Thursday 09 October 2008, Charlie Farinella wrote: > I have a string of text that I want to split on the tabs: > > while () { > my @array = split(/\t/, $_); > > ...manipulate them a little, and print them back out like so: > > print "$array[0],$array[1],$array[2]"; etc. > } > > I nor

Re: printing array elements

2008-10-09 Thread Martin Barth
Hey, > print "$array[0],$array[1],$array[2]"; etc. There are different ways: 1) print @array; usually you want to see which element is at which index so 2) print join(" - ", @array); is maybe better. HTH Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

printing array elements

2008-10-09 Thread Charlie Farinella
I have a string of text that I want to split on the tabs: while () { my @array = split(/\t/, $_); ...manipulate them a little, and print them back out like so: print "$array[0],$array[1],$array[2]"; etc. } I normally just print them as above, but I'm thinking there must be a better way

Re: printing array elements in columns

2004-06-21 Thread Zeus Odin
"Guruguhan N" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi All, Hello. Please read Charles K. Clarkson's comments. They are spot on. I will not repeat them here. > In reply to my own posting, I have written a code like the one given below. > @X = (1 .. 30) > $n_el = scala

RE: printing array elements in columns

2004-06-21 Thread Charles K. Clarkson
N, Guruguhan (GEAE, Foreign National, EACOE) <> wrote: : In reply to my own posting, I have written a code : like the one given below. : : @X = (1 .. 30); : : $n_el = scalar(@X); : $n_row = $n_el/3; # 3 is the number of columns I want. : : for ($i=0; $i<$n_row; $i++) { : f

RE: printing array elements in columns

2004-06-21 Thread N, Guruguhan \(GEAE, Foreign National, EACOE\)
30 Any comment on this welcome. Regards Guruguhan -Original Message- From: N, Guruguhan (GEAE, Foreign National, EACOE) Sent: Friday, June 18, 2004 5:08 PM To: [EMAIL PROTECTED] Subject: printing array elements in columns Hi All, I have a one dimensional array @X, containin

RE: printing array elements in columns

2004-06-18 Thread Bob Showalter
N, Guruguhan (GEAE, Foreign National, EACOE) wrote: > Hi All, > I have a one dimensional array @X, containing N elements. I > would like to know how I can print this N elements in M columns? If you want the data to read across, then down, you can do: @X = 'A' .. 'Z'; $m = 8; p

RE: printing array elements in columns

2004-06-18 Thread Tim Johnson
} } print "\n"; } -Original Message- From: N, Guruguhan (GEAE, Foreign National, EACOE) [mailto:[EMAIL PROTECTED] Sent: Fri 6/18/2004 4:38 AM To: [EMAIL PROTECTED] Cc: Subject: printing array elements in columns Hi All, I have a one dimensional a

Re: printing array elements in columns

2004-06-18 Thread Edward Wijaya
On Fri, 18 Jun 2004 17:08:08 +0530, N, Guruguhan (GEAE, Foreign National, EACOE) <[EMAIL PROTECTED]> wrote: Hi All, I have a one dimensional array @X, containing N elements. I would like to know how I can print this N elements in M columns? print join("\n", @X), "\n"; Or if you hav

printing array elements in columns

2004-06-18 Thread N, Guruguhan \(GEAE, Foreign National, EACOE\)
Hi All, I have a one dimensional array @X, containing N elements. I would like to know how I can print this N elements in M columns? TIA Guruguhan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]