Re: how to concatenate two lists

2010-09-20 Thread Shlomi Fish
On Monday 20 September 2010 09:49:27 rahul patil wrote: > Hello all, > > below is sample code i have written.Is it right way to declare ar4 which is > concatenation of ar and ar1 > > #!/usr/bin/perl > @ar = {"rahul","patil"}; You shouldn't use { ... } for arrays (this is not C). Use: my @ar = (

Re: how to concatenate two lists

2010-09-20 Thread Uri Guttman
> "PK" == Parag Kalra writes: PK> #!/usr/bin/perl PK> use strict; PK> use warnings; PK> my @ar = ("rahul","patil"); PK> my @ar1 = ("nitin"); PK> my @ar4; PK> push @ar4, (@ar, @ar1); PK> print "@ar4"; it is nice that you are trying to help but your code can be better. there is

Re: how to concatenate two lists

2010-09-20 Thread rahul patil
On Mon, Sep 20, 2010 at 1:30 PM, Chaitanya Yanamadala < dr.virus.in...@gmail.com> wrote: > @ar = ("rahul","patil"); > @ar1 = ("nitin"); > @ar4 = (@ar,@ar1); > > the only problem is u should not define the array with this { } it should > be defined within this brackets (); > > Chaitanya > > This wo

Re: how to concatenate two lists

2010-09-20 Thread Chaitanya Yanamadala
@ar = ("rahul","patil"); @ar1 = ("nitin"); @ar4 = (@ar,@ar1); the only problem is u should not define the array with this { } it should be defined within this brackets (); Chaitanya On Mon, Sep 20, 2010 at 1:19 PM, rahul patil wrote: > Hello all, > > below is sample code i have written.Is it

Re: how to concatenate two lists

2010-09-20 Thread Parag Kalra
#!/usr/bin/perl use strict; use warnings; my @ar = ("rahul","patil"); my @ar1 = ("nitin"); my @ar4; push @ar4, (@ar, @ar1); print "@ar4"; Cheers, Parag On Mon, Sep 20, 2010 at 12:49 AM, rahul patil wrote: > Hello all, > > below is sample code i have written.Is it right way to declare ar4 whi

how to concatenate two lists

2010-09-20 Thread rahul patil
Hello all, below is sample code i have written.Is it right way to declare ar4 which is concatenation of ar and ar1 #!/usr/bin/perl @ar = {"rahul","patil"}; @ar1 = {"nitin"}; @ar4 = {...@ar,@ar1}; print @ar4[2]; if yes, why it is not printing output as nitin on my system -- Regards, Rahul Patil

Re: Best way to mix two lists

2009-07-11 Thread Matteo Riva
On Fri, Jul 10, 2009 at 9:25 PM, Gunnar Hjalmarsson wrote: > You can use a hash slice. > >   �...@{ $data{$key} }{ @fields } = split /:/, $val; Thanks Gunnar, your suggestion is enlightening. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...

Re: Best way to mix two lists

2009-07-10 Thread Jim Gibson
On 7/10/09 Fri Jul 10, 2009 11:32 AM, "Matteo Riva" scribbled: > Hello everybody, I have two lists and I want to merge them like this: > > element 1 of list A, element 1 of list B, A2, B2, A3, B3, etc. > > I need this to create a sequence of key/value for an

Re: Best way to mix two lists

2009-07-10 Thread Gunnar Hjalmarsson
Matteo Riva wrote: Hello everybody, I have two lists and I want to merge them like this: element 1 of list A, element 1 of list B, A2, B2, A3, B3, etc. I need this to create a sequence of key/value for an anonymous hash. I'm using this code: # @fields contains the names of the

Re: Best way to mix two lists

2009-07-10 Thread Shawn H. Corey
On Fri, 2009-07-10 at 20:32 +0200, Matteo Riva wrote: > Hello everybody, I have two lists and I want to merge them like this: > > element 1 of list A, element 1 of list B, A2, B2, A3, B3, etc. > > I need this to create a sequence of key/value for an anonymous hash. > >

Best way to mix two lists

2009-07-10 Thread Matteo Riva
Hello everybody, I have two lists and I want to merge them like this: element 1 of list A, element 1 of list B, A2, B2, A3, B3, etc. I need this to create a sequence of key/value for an anonymous hash. I'm using this code: # @fields contains the names of the hash keys # $val

comparing two lists with hashes

2005-05-09 Thread david cateron
I’m still trying to figure out hashes. My array consists of two elements, the first is a filename and the second is a field in the file. So it looks like this: File1 UserID File1 TextID File1 Field1 File2 UserID File2 TextID File2 Field1 File2 Field2 I

Problem finding changes and differences between two lists?

2004-05-14 Thread arichmond(contr-ird)
Title: Message I am having difficulty discovering why a part of my script is doing what it is doing. I have a script that polls switches every 5 minutes to discover new MAC's. Everything works fine for discovering new MAC's but now I want to test for existing MAC's that have moved.   The co

Re: Two lists...

2003-06-11 Thread royce . wells
| | cc:

Re: Two lists...

2003-06-11 Thread Rob Dixon
James Kelty wrote: > Say I have two large lists of names (uid's). I would like to look at > both of these files and make sure that a name (uid) doesn't appear in > BOTH files. Just one or the other. Not sure how to handle that. Any ideas? The short answer is perldoc -q duplicate The long one i

Two lists...

2003-06-11 Thread James Kelty
Say I have two large lists of names (uid's). I would like to look at both of these files and make sure that a name (uid) doesn't appear in BOTH files. Just one or the other. Not sure how to handle that. Any ideas? Thanks. -James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com