Re: array population from system app call

2004-05-25 Thread DBSMITH
<[EMAIL PROTECTED]> 05/25/2004 02:59 PM To: [EMAIL PROTECTED] cc: Perl Beginners <[EMAIL PROTECTED]> Subject: Re: array population from system app call On May 25, 2004, at 1:34 PM, [EMAIL PROTECTED] wrote: > ok so now I can get all element

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 1:34 PM, [EMAIL PROTECTED] wrote: ok so now I can get all elements printed using my @ftapes = ( ); my @ftapes = `evmvol -w label_state=3|grep barcode`; foreach $_ (@ftapes) { print $_ , "\n"; } so now I want to use multidi

Re: array population from system app call

2004-05-25 Thread DBSMITH
ok so now I can get all elements printed using my @ftapes = ( ); my @ftapes = `evmvol -w label_state=3|grep barcode`; foreach $_ (@ftapes) { print $_ , "\n"; } so now I want to use multidimensional arrays using print $ftapes[0,1] does pri

Re: array population from system app call

2004-05-25 Thread DBSMITH
excellent I did not know that about system! thanks again! Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams James Edward Gray II <[EMAIL PROTECTED]> 05/25/2004 02:08 PM To: [EMAIL PROTECTED] cc: Perl Beginners <[EMAIL PROTECTED]> Subjec

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 1:03 PM, [EMAIL PROTECTED] wrote: cool, but why doesn't my @ftapes = system ("evmvol -w label_state=3|grep barcode"); print $ftapes[0] OR print $ftapes[0,1] work? Because system() does not return the program's output, it returns exit status. I see that it does not support mult

RE: array population from system app call

2004-05-25 Thread DBSMITH
ms 614-566-4145 "Halkyard, Jim" <[EMAIL PROTECTED]> 05/25/2004 01:58 PM To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> cc: Subject:RE: array population from system app call To capture output you need the backticks my @ou

Re: array population from system app call

2004-05-25 Thread James Edward Gray II
On May 25, 2004, at 12:45 PM, [EMAIL PROTECTED] wrote: All, was hoping anyone could provide some syntax help. I want to populate an array from a system app call like so and then print out each element. my @ftapes = system ("evmvol -w label_state=3|grep barcode"); print $ftapes[0]; You're lookin

RE: array population from system app call

2004-05-25 Thread Halkyard, Jim
To capture output you need the backticks my @output = `put your command here`; The return value of a system call is the return value of the program you call. See perldoc perlfaq8 for more info Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 25 May 2004

Re: array output

2004-05-24 Thread DBSMITH
or each element to hold 1 line. Will the diamond operator work here? derek "Paul D. Kraus" <[EMAIL PROTECTED]> 05/21/2004 04:39 PM To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject:Re: array output Not completely sure what you ar

RE: array output

2004-05-23 Thread Marcos . Rebelo
Doing a fork shall help. Child runs the system command and exit. Pather creats a new child for the rest. foreach my $cmd (@cmds) { if (fork() == 0) { # child system($cmd); exit(0); } } Is this what you need? Marcos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: array output

2004-05-21 Thread Paul D. Kraus
Not completely sure what you are trying to do but you can join all the elements like this my $mystring = join " ", @myarray; this will join each elements into one string seperated by a space. Paul On Fri, May 21, 2004 at 02:07:56PM -0400, [EMAIL PROTECTED] wrote: > All, > > I have an array of

Re: Array with unique elements only

2004-05-21 Thread Mark Martin
Thanks Ramprasad - that works. At 17:29 20/05/2004 +0530, Ramprasad A Padmanabhan wrote: Wow, unique items is surely an FAQ. But here you dont need to filter the array, just see the answer inline On Thu, 2004-05-20 at 17:07, Mark Martin wrote: > Hi, > I'm moving database data from table to table an

Re: Array with unique elements only

2004-05-20 Thread Rob Dixon
Ramprasad A Padmanabhan wrote: > > Wow, > unique items is surely an FAQ. > But here you dont need to filter the array, just see the answer inline > > On Thu, 2004-05-20 at 17:07, Mark Martin wrote: > > Hi, > > I'm moving database data from table to table and want to make sure I'm > > getting only u

Re: Array with unique elements only

2004-05-20 Thread Jeff 'japhy' Pinyan
On May 20, Jeff 'japhy' Pinyan said: > my (%count, %unique); > > while (my @row = $sth->fetchrow) { >my $field = $row[0]; >if ($count{$field}++) { delete $unique{$field} } >else { $unique{$field} = [ @row ] }; # or 1, or whatever you want > } > >Here, every time a row is seen, its

Re: Array with unique elements only

2004-05-20 Thread Jeff 'japhy' Pinyan
On May 20, Mark Martin said: >I'm moving database data from table to table and want to make sure I'm >getting only unique records. This is similar to a topic that came up two days ago. >Only want unique $field1 and was looking at the cookbook code, but for that >I have to populate a hash and the

Re: Array with unique elements only

2004-05-20 Thread Ramprasad A Padmanabhan
Wow, unique items is surely an FAQ. But here you dont need to filter the array, just see the answer inline On Thu, 2004-05-20 at 17:07, Mark Martin wrote: > Hi, > I'm moving database data from table to table and want to make sure I'm > getting only unique records. > > Only want unique $field1 a

Re: Array in a regexp

2004-05-07 Thread John W. Krahn
Jason Dusek wrote: > > Hi List, Hello, > Let's say I want to know if anything in @ARGV has one of a certain list > of suffixes in it. So I write: > >foreach (@ARGV) { > print if (/\.(fish|foul)$/); >} > > But if I have a long list of suffixes, then I would like to store the > suff

Re: Array in a regexp

2004-05-07 Thread Jenda Krynicky
From: Alok Bhatt <[EMAIL PROTECTED]> > --- Jason Dusek <[EMAIL PROTECTED]> wrote: > > Hi List, > > But if I have a long list of suffixes, then I would > > like to store the > > suffixes in an array, and then evaluate the array in > > my regular > > expression. What does this? I've tried: > > > >

Re: Array in a regexp

2004-05-07 Thread Jeff 'japhy' Pinyan
On May 7, Jason Dusek said: >But if I have a long list of suffixes, then I would like to store the >suffixes in an array, and then evaluate the array in my regular >expression. What does this? I've tried: > > @SUFF = (fish,foul); I think you mean @SUFFIXES. That's the array you use below... >

Re: Array in a regexp

2004-05-07 Thread Alok Bhatt
--- Alok Bhatt <[EMAIL PROTECTED]> wrote: > > --- Jason Dusek <[EMAIL PROTECTED]> wrote: > > Hi List, > > But if I have a long list of suffixes, then I > would > > like to store the > > suffixes in an array, and then evaluate the array > in > > my regular > > expression. What does this? I've tr

Re: Array in a regexp

2004-05-07 Thread Alok Bhatt
--- Jason Dusek <[EMAIL PROTECTED]> wrote: > Hi List, > But if I have a long list of suffixes, then I would > like to store the > suffixes in an array, and then evaluate the array in > my regular > expression. What does this? I've tried: > >@SUFF = (fish,foul); >foreach (@ARGV) { >

RE: Array of objects

2004-03-04 Thread Jayakumar Rajagopal
; [EMAIL PROTECTED] Subject: RE: Array of objects Jayakumar Rajagopal wrote: > Hi , > I have to store list of objects in Array. At the end, @arr contains n > copies of last $obj, but not every $obj created. I tried storing both > object, ref of object. Array contains different referenc

RE: Array of objects

2004-03-04 Thread Jayakumar Rajagopal
, March 04, 2004 1:38 PM To: Jayakumar Rajagopal; [EMAIL PROTECTED] Subject: RE: Array of objects Jayakumar Rajagopal wrote: > Hi , > I have to store list of objects in Array. At the end, @arr contains n > copies of last $obj, but not every $obj created. I tried storing both > object, r

RE: Array of objects

2004-03-04 Thread Bob Showalter
Jayakumar Rajagopal wrote: > Hi , > I have to store list of objects in Array. At the end, @arr contains n > copies of last $obj, but not every $obj created. I tried storing both > object, ref of object. Array contains different references, but same > data. Please help. > thanks, > Jay > > the cu

Re: Array of objects

2004-03-04 Thread WC -Sx- Jones
Jayakumar Rajagopal wrote: Hi , I have to store list of objects in Array. At the end, @arr contains n copies of last $obj, but not every $obj created. I tried storing both object, ref of object. Array contains different references, but same data. Please help. thanks, OK, this URL is not your qu

Re: Array question

2004-02-28 Thread R. Joseph Newton
"R. Joseph Newton" wrote: > Chris wrote: > > > my %found = (); > > foreach (@emails) { $found{$_}++ }; > > foreach (@exclude) { exists $found{$_} and delete $found{$_} } > > Too complicated. Check Wolf's suggestion: Ooops, excuse the brain fart: > > $unwanted{$_} = 1 foreach @exclude; > my @tem

Re: Array question

2004-02-28 Thread R. Joseph Newton
Chris wrote: > my %found = (); > foreach (@emails) { $found{$_}++ }; > foreach (@exclude) { exists $found{$_} and delete $found{$_} } Too complicated. Check Wolf's suggestion: $unwanted{$_} = 1 foreach @exclude; my @temp; push @temp while (my $email = shift @emails) { push @temp, $email unles

Re: Array question

2004-02-27 Thread Tim
At 07:18 PM 2/26/04 -0500, you wrote: Hi Guys, I have a problem with e-mail address's and an array. I have some code that will be a documentation spider to go through all our technical documentation, extract e-mail address's and attempt to sort and exclude certain e-mails/patterns. All documentati

Re: Array question

2004-02-26 Thread wolf blaum
On Friday 27 February 2004 01:18, Chris generously enriched virtual reality by making up this one: > Hi Guys, > > I have a problem with e-mail address's and an array. I have some code that > will be a documentation spider to go through all our technical > documentation, extract e-mail address's a

Re: array assistance needed

2004-02-17 Thread Wiggins d'Anconia
Paul Kraus wrote: Oh yea check out perldoc perllol. Excellent advice, in addition, perldoc perldsc perldoc perlreftut perldoc perlref http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: array assistance needed

2004-02-17 Thread jeffrey_n_Dyke
> I'd like to create a numerically indexed associtative array, each key will > contain an array of three elements like: > > $array[0] = ("element0", "element1", "element2"); > $array[1] = ("element0", "element1", "element2"); > $array[3] = ("element0", "element1", "element2"); > etc. >>Why us

RE: array assistance needed

2004-02-17 Thread Paul Kraus
Oh yea check out perldoc perllol. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: array assistance needed

2004-02-17 Thread Paul Kraus
> I'd like to create a numerically indexed associtative array, each key will > contain an array of three elements like: > > $array[0] = ("element0", "element1", "element2"); > $array[1] = ("element0", "element1", "element2"); > $array[3] = ("element0", "element1", "element2"); > etc. Why use an a

Re: Array containment

2004-02-11 Thread Rob Dixon
James Edward Gray II wrote: > [other stuff and] > > Of the solutions not using exists, I come in third (range). That's not > > bad for an amateur or is it? ;) > > Not bad at all. Your solution was clever, I think, and may even have > practical uses, since it retains an array order in the hash va

Re: Array containment

2004-02-11 Thread James Edward Gray II
On Feb 11, 2004, at 9:23 AM, Jan Eden wrote: James Edward Gray II wrote: Now it might be hard to determine which of these two is faster. And the results, from my G5: Benchmark: timing 300 iterations of all_ones, foreach, hash_slice, map_hash, map_ones, range... all_ones: 1 wallclock secs

Re: Array containment

2004-02-11 Thread Jan Eden
James Edward Gray II wrote: >> Now it might be hard to determine which of these two is faster. >And the results, from my G5: > >Benchmark: timing 300 iterations of all_ones, foreach, hash_slice, >map_hash, map_ones, range... > all_ones: 1 wallclock secs ( 1.76 usr + 0.00 sys = 1.76 CPU

Re: Array containment

2004-02-11 Thread Rob Dixon
Jan Eden wrote: > > Rob, James, > > James Edward Gray II wrote: > > > > What's wrong with exists()? I like exists() and you're going to hurt > > it's feelings. :) > > > > It has six characters which can be left out to minimize typing. Proper Perl programmers like typing ;) And so do you given:

Re: Array containment

2004-02-11 Thread James Edward Gray II
On Feb 11, 2004, at 12:14 AM, Jan Eden wrote: James Edward Gray II wrote: On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: Rob, I read the perlfaq paragraph you mentioned and found that it proposes a solution which does not make use of 'exists': What's wrong with exists()? I like exists() and you'r

Re: Array containment

2004-02-10 Thread Jan Eden
Rob, James, James Edward Gray II wrote: >On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: >> Rob, I read the perlfaq paragraph you mentioned and found that it >> proposes a solution which does not make use of 'exists': > >What's wrong with exists()? I like exists() and you're going to hurt >it's

Re: Array containment

2004-02-10 Thread John W. Krahn
James Edward Gray II wrote: > > On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: > > > > @blues = qw/azure cerulean teal turquoise lapis-lazuli/; > > %is_blue = (); > > for (@blues) { $is_blue{$_} = 1 } > > > > Now, I had the idea to combine your hash slice with this solution > > doing: > > > > @blues

Re: Array containment

2004-02-10 Thread Rob Dixon
Jan Eden wrote: > > Rob, I read the perlfaq paragraph you mentioned and found that it proposes a > solution which does not make use of 'exists': > > @blues = qw/azure cerulean teal turquoise lapis-lazuli/; > %is_blue = (); > for (@blues) { $is_blue{$_} = 1 } It's not for me to rewrite the docs (or

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: James, Rob, Japhy, I am impressed, really. Thank you! Me too. We haven't scared you off yet. :) Impressive. Rob, I read the perlfaq paragraph you mentioned and found that it proposes a solution which does not make use of 'exists': What's wrong wit

Re: Array containment

2004-02-10 Thread Jan Eden
James, Rob, Japhy, I am impressed, really. Thank you! Rob, I read the perlfaq paragraph you mentioned and found that it proposes a solution which does not make use of 'exists': @blues = qw/azure cerulean teal turquoise lapis-lazuli/; %is_blue = (); for (@blues) { $is_blue{$_} = 1 } Now, I had

Re: Array containment

2004-02-10 Thread Rob Dixon
Jeff 'Japhy' Pinyan wrote: > > >I said I cannot fix the grep() version. I'm just not that cool. > > I guess I'm cooler than you. ;) > > sub find { > my $wanted = shift; > my $found = 0; > { grep $_ eq $wanted && ++$found && last, @_ } > return $found; > } Ouch! Nobody knows yo

Re: Array containment

2004-02-10 Thread Jeff 'japhy' Pinyan
On Feb 10, Jeff 'japhy' Pinyan said: >On Feb 10, James Edward Gray II said: > >>I said I cannot fix the grep() version. I'm just not that cool. > >I guess I'm cooler than you. ;) > > sub find { >my $wanted = shift; >my $found = 0; >{ grep $_ eq $wanted && ++$found && last, @_ } >

Re: Array containment

2004-02-10 Thread Jeff 'japhy' Pinyan
On Feb 10, James Edward Gray II said: >I said I cannot fix the grep() version. I'm just not that cool. I guess I'm cooler than you. ;) sub find { my $wanted = shift; my $found = 0; { grep $_ eq $wanted && ++$found && last, @_ } return $found; } -- Jeff "japhy" Pinyan

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 11:20 AM, Rob Dixon wrote: James wrote: On Feb 10, 2004, at 5:04 AM, Jan Eden wrote: Now I found a nicer solution in "Learning Perl Objects, References & Modules" and adapted it: sub contains { my $contained = shift; my $result = grep { $contained eq $_ } @_; } Again,

Re: Array containment

2004-02-10 Thread Rob Dixon
James wrote: > > On Feb 10, 2004, at 5:04 AM, Jan Eden wrote: > > > Now I found a nicer solution in "Learning Perl Objects, References & > > Modules" and adapted it: > > > > sub contains { > > my $contained = shift; > > my $result = grep { $contained eq $_ } @_; > > } > > Again, no need for

Re: Array containment

2004-02-10 Thread Jan Eden
James Edward Gray II wrote: >On Feb 10, 2004, at 8:53 AM, Jan Eden wrote: > >> Rob Dixon wrote: >> >>> @[EMAIL PROTECTED] = (); >>> >> I see. But shouldn't the last line be a complete hash slice: >> >> [EMAIL PROTECTED] = (); > >Rob's line is a hash slice. Note the @. Yours is a simple hash >

Re: Array containment

2004-02-10 Thread Jan Eden
James Edward Gray II wrote: >That works, though I would probably drop the extra variable. > >sub contains { > my $contained = shift; > foreach (@_) { return 1 if $_ eq $contained; } > return 0; >} > Perfect. Returns 1 as soon as it finds the element. >I'm not Randal, but will I do? > To

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 8:53 AM, Jan Eden wrote: Rob Dixon wrote: @[EMAIL PROTECTED] = (); I see. But shouldn't the last line be a complete hash slice: [EMAIL PROTECTED] = (); Rob's line is a hash slice. Note the @. Yours is a simple hash lookup, one scalar value affected, thus the $. James -

Re: Array containment

2004-02-10 Thread James Edward Gray II
On Feb 10, 2004, at 5:04 AM, Jan Eden wrote: Hi all, Howdy. a while ago, I wrote a little subroutine to test wether a given element is in a given array: sub contains { my $result = 0; my $contained = shift; foreach (@_) { if ($_ eq $contained){ $result = 1; } } $res

Re: Array containment

2004-02-10 Thread Jan Eden
Hi Rob, Rob Dixon wrote: >Hi Jan. > >If you want to test a static (unchanging) array for the containment of many >different >values you should build a hash out of the array elements: > > my @data = 'a' .. 'm'; > my %data_hash; > @[EMAIL PROTECTED] = (); > I see. But shouldn't the last line be

Re: Array containment

2004-02-10 Thread Rob Dixon
Jan Eden wrote: > > a while ago, I wrote a little subroutine to test wether a given element is in a > given array: > > sub contains { > > my $result = 0; > my $contained = shift; > foreach (@_) { > if ($_ eq $contained){ $result = 1; } > } > $result; > } > > Now I found

Re: Array subtraction, like sets

2004-01-31 Thread Jeff 'japhy' Pinyan
On Feb 1, Robin Sheat said: >On Fri, Jan 30, 2004 at 10:33:27AM -0500, Jeff 'japhy' Pinyan wrote: >> sub array_diff { >> my ($first, $second) = @_; >> my %diff = map { "@$_" => 1 } @$second; >> return [ map !$diff{"@$_"}, @$first ]; >> } >amended to: >return [ grep !$diff{"@$_"

Re: Array subtraction, like sets

2004-01-31 Thread Robin Sheat
On Fri, Jan 30, 2004 at 10:33:27AM -0500, Jeff 'japhy' Pinyan wrote: > sub array_diff { > my ($first, $second) = @_; > my %diff = map { "@$_" => 1 } @$second; > return [ map !$diff{"@$_"}, @$first ]; > } amended to: return [ grep !$diff{"@$_"}, @$first ]; (for the benefit of any

Re: Array subtraction, like sets

2004-01-30 Thread Robin Sheat
On Fri, Jan 30, 2004 at 10:33:27AM -0500, Jeff 'japhy' Pinyan wrote: > Well, that only works if $a[0] is [1,2,3] and $b[1] is $a[0] -- that is, > the EXACT SAME reference. It won't work if $b[1] is its own [1,2,3]. Hmm, right. Not so good. I had thought of that, and thought I tested it in that si

RE: Array subtraction, like sets

2004-01-30 Thread Bob Showalter
Robin Sheat wrote: > Hey there, what is a nice way of doing what this looks like it should > do: > > @a=([1,2,3],[5,5,5],[9,8,7]); > @b=([5,5,5],[1,2,3]); > @[EMAIL PROTECTED]@b; > > and have @c == ([1,2,3]); > > Is there a good way of doing this? (I've tried the obvious things on > the command

Re: Array subtraction, like sets

2004-01-30 Thread Jeff 'japhy' Pinyan
On Jan 31, Robin Sheat said: >> > @a=([1,2,3],[5,5,5],[9,8,7]); >> > @b=([5,5,5],[1,2,3]); >> > @[EMAIL PROTECTED]@b; ># ># subArray - takes two array references, and subtracts any instances ># of the arrays in the second one from the first one. Returns the new list. >sub subArray { >my @

Re: Array subtraction, like sets

2004-01-30 Thread Robin Sheat
On Fri, Jan 30, 2004 at 07:48:35AM -0700, Wiggins d Anconia wrote: > Going to need more info about what you think this looks like it should > do, because I (and maybe others here) lack the math skills to get your > answer, funny, I got [9,8,7]. Thats what I get for not profraedinng, the result shou

Re: Array subtraction, like sets

2004-01-30 Thread Wiggins d Anconia
> > Hey there, what is a nice way of doing what this looks like it should > do: > Going to need more info about what you think this looks like it should do, because I (and maybe others here) lack the math skills to get your answer, funny, I got [9,8,7]. > @a=([1,2,3],[5,5,5],[9,8,7]); > @b=([5

Re: array push

2004-01-28 Thread Rob Dixon
Wolf Blaum wrote: > > For Quality purpouses, Rob Dixon 's mail on Tuesday 27 January 2004 00:30 may > have been monitored or recorded as: > > > The right conclusion for the wrong reasons Wolf! The spaces are the result > > of interpolating the array into a string, and the presence of a newline o

Re: array push

2004-01-28 Thread Rob Dixon
Wolf Blaum wrote: > > For Quality purpouses, Rob Dixon 's mail on Tuesday 27 January 2004 12:42 may > have been monitored or recorded as: > > > Didn't you mean to put spaces before the last three records? This will be > > the result of > > > .. > well - in Anthonys original mail there were spaces

Re: array push

2004-01-27 Thread Rob Dixon
Wolf Blaum wrote: > > For Quality purpouses, Rob Dixon 's mail on Tuesday 27 January 2004 00:30 may > have been monitored or recorded as: > > > The right conclusion for the wrong reasons Wolf! The spaces are the result > > of interpolating the array into a string, and the presence of a newline on >

Re: array push

2004-01-27 Thread wolf blaum
For Quality purpouses, Rob Dixon 's mail on Tuesday 27 January 2004 00:30 may have been monitored or recorded as: > The right conclusion for the wrong reasons Wolf! The spaces are the result > of interpolating the array into a string, and the presence of a newline on > each array element is immat

Re: array push

2004-01-27 Thread wolf blaum
For Quality purpouses, Rob Dixon 's mail on Tuesday 27 January 2004 12:42 may have been monitored or recorded as: > Didn't you mean to put spaces before the last three records? This will be > the result of > .. well - in Anthonys original mail there were spaces - i just copied that. > > Or did

Re: array push

2004-01-26 Thread Rob Dixon
Wolf Blaum wrote: > > For Quality purpouses, Anthony J Segelhorst 's mail on Monday 26 January 2004 > 17:17 may have been monitored or recorded as: > > > How come when I push a variable to an array it puts one whitespace before > > the variables on all the lines except the first one? I would except

Re: array push

2004-01-26 Thread Anthony J Segelhorst
blaum <[EMAIL PROTECTED]> 01/26/2004 11:39 AM To:  cc: Subject:Re: array push For Quality purpouses, Anthony J Segelhorst 's mail on Monday 26 January 2004 17:17 may have been monitored or recorded as: > How come when I push a variable to an array it

Re: array push

2004-01-26 Thread wolf blaum
For Quality purpouses, Anthony J Segelhorst 's mail on Monday 26 January 2004 17:17 may have been monitored or recorded as: > How come when I push a variable to an array it puts one whitespace before > the variables on all the lines except the first one?  I would except all > the lines not to hav

Re: array push

2004-01-26 Thread Tim
At 11:17 AM 1/26/04 -0500, you wrote: print "@temparray"; Take the quotes off. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Array creation with a existing variable

2004-01-26 Thread Jenda Krynicky
From: Ravi Malghan <[EMAIL PROTECTED]> > Hi: I have a existing variable called $router which is > "192.168.1.1". I want to create a array which looks > like @Counter192.168.1.1. Please read "Why it's stupid to `use a variable as a variable name'" by M-J. Dominus http://www.plover.com/~m

Re: Array creation with a existing variable

2004-01-24 Thread Ravi Malghan
Wiggins: basically what I was trying to do is track a counter value for each router in my network. These routers may come and go. At some time I may have 10 routers at other times 100. $Counter{$router1} = {n1, n2, n3, ...nN} $Counter{$router2} = {m1, m2, m3, ...mN} ... $Counter{$routerX} = I

Re: Array creation with a existing variable

2004-01-23 Thread Randal L. Schwartz
> "Ravi" == Ravi Malghan <[EMAIL PROTECTED]> writes: Ravi> Hi: I have a existing variable called $router which is Ravi> "192.168.1.1". I want to create a array which looks Ravi> like @Counter192.168.1.1. No, you don't. You really, really don't. You may think you do, if you're bringing tech

Re: Array creation with a existing variable

2004-01-23 Thread Wiggins d Anconia
Please bottom post... > True. Since the value(s) for @Counter$router is going > to be array, manipulating that hash was making things > complex for me. > > If I use a hash (%Counter), what do I have to do such > that the resulting value for $Counter{$router} is an > array. > You still haven't t

Re: Array creation with a existing variable

2004-01-23 Thread Ravi Malghan
I may have found the answer, I could use @{$Counter{$router}} . I will try this. Thanks Ravi --- Ravi Malghan <[EMAIL PROTECTED]> wrote: > True. Since the value(s) for @Counter$router is > going > to be array, manipulating that hash was making > things > complex for me. > > If I use a hash (%Coun

Re: Array creation with a existing variable

2004-01-23 Thread Ravi Malghan
True. Since the value(s) for @Counter$router is going to be array, manipulating that hash was making things complex for me. If I use a hash (%Counter), what do I have to do such that the resulting value for $Counter{$router} is an array. Thanks Ravi --- Wiggins d Anconia <[EMAIL PROTECTED]> wrote

Re: Array creation with a existing variable

2004-01-23 Thread Wiggins d Anconia
> Hi: I have a existing variable called $router which is > "192.168.1.1". I want to create a array which looks > like @Counter192.168.1.1. > > @Counter.$router does not seem to work. > > Thanks in advance > Ravi The first question is why? I suspect first that the dots in the name of the var

Re: Array Manipulations

2004-01-08 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > Hello Everyone, Hello, > I am a Perl newbie trying to learn as much Perl as I can. I am trying to > combine specific array elements into one single array element so that I can > write > to an Excel cell, where all the data will fit. > > For instance I have, > > ar

Re: Array Representation

2003-12-23 Thread John W. Krahn
Ursala Luttrell wrote: > > I need to modify an existing perl script. Within the code the following > appears: > > @unique_array[12..24]= > $first_total,$second_total,$third_total,$fourth_total,undef,$fifth_total,$si > xth_total,undef,1000); > > I don't understand what the function of [12..24] i

Re: Array Representation

2003-12-23 Thread Rob Dixon
Ursala Luttrell wrote: > > I need to modify an existing perl script. Within the code the following > appears: > > @unique_array[12..24]= > $first_total,$second_total,$third_total,$fourth_total,undef,$fifth_total,$si > xth_total,undef,1000); > > I don't understand what the function of [12..24] is.

RE: Array Representation

2003-12-23 Thread Tom Kinzer
that says assign elements 12 through 24 of that array these values. element numbering in perl starts at zero, so 12 is the 13th element in the array. -Tom Kinzer -Original Message- From: Ursala Luttrell [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 10:41 AM To: [EMAIL PROTEC

RE: Array de-referencing problem

2003-11-21 Thread Jenda Krynicky
From: "Paul Harwood" <[EMAIL PROTECTED]> > Thanks! > > I got it to work using: > > $server {$thread}->{$logfile}->{$delay} = [EMAIL PROTECTED]; > > But I guess it's better to use an array reference? You are using an array reference. The difference is that $server {$thread}->{$logfile

RE: Array de-referencing problem

2003-11-21 Thread Paul Harwood
onversation: Array de-referencing problem Subject: Re: Array de-referencing problem From: "Paul Harwood" <[EMAIL PROTECTED]> > I wrote the following code: > > $thread = "TEFD0"; > $logfile = "V_DEBUG12121.txt"; > $delay = "10232"

Re: Array de-referencing problem

2003-11-21 Thread Jenda Krynicky
From: "Paul Harwood" <[EMAIL PROTECTED]> > I wrote the following code: > > $thread = "TEFD0"; > $logfile = "V_DEBUG12121.txt"; > $delay = "10232"; > @servers = qw (SERVER1 SERVER2 SERVER3 SERVER4); > $server {$thread}->{$logfile}->{$delay} = @servers; The first problem is here. You are evaluating

Re: array of elements

2003-10-28 Thread Andrew Gaffney
Steve Grazzini wrote: On Mon, Oct 27, 2003 at 09:52:20PM -0600, Andrew Gaffney wrote: I have an array of keywords that I need to generate. I have 2 separate input files. The first one contains the defaults. The second input file contains additions and overrides. For example, first input: key1 k

Re: array of elements

2003-10-27 Thread Steve Grazzini
On Mon, Oct 27, 2003 at 09:52:20PM -0600, Andrew Gaffney wrote: > I have an array of keywords that I need to generate. I have 2 separate > input files. The first one contains the defaults. The second input file > contains additions and overrides. For example, first input: > > key1 key2 key3 key4

Re: array of elements

2003-10-27 Thread Andrew Gaffney
How would I go about this? simran wrote: a way i can think of is: * read first file and put keys in hash (%h) * read second file and add/delete from hash (%h) as needed * print keys of %h On Tue, 2003-10-28 at 14:52, Andrew Gaffney wrote: I have an array of keywords that I need to generate. I

RE: Array Reference Practice Help

2003-10-26 Thread Charles K. Clarkson
Jakob Lell <[EMAIL PROTECTED]> wrote: : : you can use prototypes to pass array references. : see perldoc perlsub for more details. : : sub showIt([EMAIL PROTECTED]@); : my @alpha=("a","b","c"); : my @numer=(1,2,3); : showIt(@alpha,@numer); : sub showIt([EMAIL PROTECTED]@) : { : my($a,$b) = @

Re: Array Reference Practice Help

2003-10-26 Thread Jakob Lell
On Sunday 26 October 2003 10:35, [EMAIL PROTECTED] wrote: > Is this a standard/normal/ok way to pass and use array by reference? > > @alpha=("a","b","c"); > @numer=(1,2,3); > > #calling by reference > showIt([EMAIL PROTECTED], [EMAIL PROTECTED]); > > sub showIt > { my $a = $_[0]; #assinging by ref

Re: Array Reference Practice Help

2003-10-26 Thread Tore Aursand
On Sun, 26 Oct 2003 01:35:47 -0800, perl wrote: > Is this a standard/normal/ok way to pass and use array by reference? Almost, I would say. > #calling by reference > showIt([EMAIL PROTECTED], [EMAIL PROTECTED]); > > sub showIt > { my $a = $_[0]; #assinging by reference > my $b = $_[1]; > > p

RE: array of arrays

2003-10-20 Thread Stephen Hardisty
Alright then, first you want to think about how you are going to populate the arrays. For example, if I have a file that contains the following data: 1|10 5|7 I would do this: open(FH, "< bob.txt"); my @file_list; while() { # add a reference of the 2 file columns to @file_list

Re: array of arrays

2003-10-20 Thread Tassilo von Parseval
On Mon, Oct 20, 2003 at 12:33:00PM +0200 Christiane Nerz wrote: > How do I read data out of a table-file in an array-of-arrays? > > Problem: I have to compare two tables with pairs of start-stop-Positions. > I want to find out, which pair of Start-Stop-Position in table_1 is > entirely within th

Antwort: RE: array of arrays

2003-10-20 Thread Manfred . Beilfuss
<[EMAIL PROTECTED]Kopie: elabs.com> Thema: RE: array of arrays

Re: array of arrays

2003-10-20 Thread Christiane Nerz
... from two text files. Output of a pattern-searching-program and data out of a DB (genebank). No prob to read in those data in a textfile too. Stephen Hardisty wrote: How do I read data out of a table-file in an array-of-arrays? Problem: I have to compare two tables with pairs of start-stop-P

RE: array of arrays

2003-10-20 Thread Stephen Hardisty
> How do I read data out of a table-file in an array-of-arrays? > > Problem: I have to compare two tables with pairs of start-stop-Positions. > I want to find out, which pair of Start-Stop-Position in table_1 > is > entirely within the range marked by a pair of start-stop-positions of > the seco

Re: array inside an array

2003-10-14 Thread Jorge Barrios
[EMAIL PROTECTED] (Guruguhan N) writes: > Hi All, > I have recently started using Perl for my project. I have a problem in > getting elements of the following array. > > @array1 = ( [ x1, x2, x3], > [ x4, x5, x6], > [ x7, x8, x9]); > > I would like to get the el

RE: array inside an array

2003-10-13 Thread N, Guruguhan (GEAE, Foreign National, EACOE)
] Subject: Re: array inside an array "N, Guruguhan (GEAE, Foreign National, EACOE)" wrote: > Hi All, > I have recently started using Perl for my project. I have a problem in getting elements of the following array. > > @array1 = ( [ x1, x2, x3], >

Re: array inside an array

2003-10-13 Thread simran
Hello Guru, Your variable in english would be termed as: * An Array whose elements are "Reference to Arrays". As such, you can get to the elements via: $array[0]->[0] will be x1 $array[0]->[1] will be x2 ... $array[2]->[1] will be x8 Have a look at % perldoc perlref for more info... On Tu

Re: array inside an array

2003-10-13 Thread Sudarshan Raghavan
"N, Guruguhan (GEAE, Foreign National, EACOE)" wrote: > Hi All, > I have recently started using Perl for my project. I have a problem in > getting elements of the following array. > > @array1 = ( [ x1, x2, x3], > [ x4, x5, x6], > [ x7, x8, x9]); @array1 is an

Re: Array to hash with reverse split?

2003-08-20 Thread John W. Krahn
Linux Rocks wrote: > > John> Perl has the tools to do most of that without running an external > John> program like 'ls' or 'grep'. > > Yes, thank you, I know. I will be dealing with data that is arranged SIMILAR > TO THE OUPUT OF ls -l, NOT THE ACTUAL OUTPUT OF THAT COMMAND and it will have > N

<    1   2   3   4   5   6   7   8   >