From oleber at gmail.com Tue Oct 6 00:27:36 2009 From: oleber at gmail.com (marcos rebelo) Date: Tue, 6 Oct 2009 09:27:36 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <319d96980909200157q693c8d48wffbd5eecd186f89d@mail.gmail.com> References: <319d96980909200157q693c8d48wffbd5eecd186f89d@mail.gmail.com> Message-ID: <319d96980910060027q7469d8f4t6a159d30f39e9386@mail.gmail.com> On Sun, Sep 20, 2009 at 10:57 AM, marcos rebelo wrote: > Hi all > > Time to get the October Monthly Meeting. > http://www.doodle.com/pwp7kp6282mpx5um > > Best Regards > Marcos Rebelo > > -- > Marcos Rebelo > http://oleber.freehostia.com > Milan Perl Mongers leader http://milan.pm.org > Let's make it Thursday, at 21h, to get most of the persons satisfied. Where shall we go? La Fabrica or someone else have a different idea? Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From paola.bisignano at gmail.com Tue Oct 6 03:32:08 2009 From: paola.bisignano at gmail.com (Paola Bisignano) Date: Tue, 6 Oct 2009 12:32:08 +0200 Subject: [Milan-pm] comparing 2 lists Message-ID: Hi, I have two lists of numbers, saved in two files and I want to compare them, in order to check which are the same elements in both lists. I put them into array, so I want to compare array, but I only want to check the value, and It doesn't matter for the position in the array, I tried to use Array::Compare open (OUT, "> $file"); my $comp = Array::Compare-> new; if ($comp->compare(\@array_num1, \@array_num2)) { print "$comp\n"; print OUT "$comp\n"; } close OUT; but it returns blank, I don't know why... From lally22 at gmail.com Tue Oct 6 03:36:05 2009 From: lally22 at gmail.com (Lally Blue) Date: Tue, 6 Oct 2009 12:36:05 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: References: Message-ID: are the 2 arrays items in the same order? in the reference it says: "Internally the comparator compares the two arrays by using join to turn both arrays into strings and comparing the strings using eq." so I guess that if the first array has 1,2,3,4,5 and the second one 5,4,3,2,1 the Array::Compare returns false... is this what you mean? -Ilaria- On Tue, Oct 6, 2009 at 12:32 PM, Paola Bisignano wrote: > Hi, > I have two lists of numbers, saved in two files and I want to compare > them, in order to check which are the same elements in both lists. I > put them into array, so I want to compare array, but I only want to > check the value, and It doesn't matter for the position in the array, > I tried to use Array::Compare > > > > open (OUT, "> $file"); > my $comp = Array::Compare-> new; > if ($comp->compare(\@array_num1, > \@array_num2)) > { > print "$comp\n"; > print OUT "$comp\n"; > } > close OUT; > > but it returns blank, I don't know why... > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paola.bisignano at gmail.com Tue Oct 6 03:38:56 2009 From: paola.bisignano at gmail.com (Paola Bisignano) Date: Tue, 6 Oct 2009 12:38:56 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: References: Message-ID: yes I mean that they are not in the same order and I only need to return the elements that are both in the two array 2009/10/6 Lally Blue : > are the 2 arrays items in the same order? > in the reference it says: > "Internally the comparator compares the two arrays by using join to turn > both arrays into strings and comparing the strings using eq." > so I guess that if the first array has 1,2,3,4,5 and the second one > 5,4,3,2,1 the Array::Compare returns false... > is this what you mean? > ? -Ilaria- > On Tue, Oct 6, 2009 at 12:32 PM, Paola Bisignano > wrote: >> >> Hi, >> I have two lists of numbers, saved in two files and I want to compare >> them, in order to check which are the same elements in both lists. I >> put them into array, so I want to compare array, but I only want to >> check the value, and It doesn't matter for the position in the array, >> I tried to use Array::Compare >> >> >> >> open (OUT, "> $file"); >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?my $comp = Array::Compare-> new; >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($comp->compare(\@array_num1, >> \@array_num2)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?print "$comp\n"; >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?print OUT "$comp\n"; >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?close OUT; >> >> but it returns blank, I don't know why... >> _______________________________________________ >> Milan-pm mailing list >> Milan-pm at pm.org >> http://mail.pm.org/mailman/listinfo/milan-pm > > > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > > From oleber at gmail.com Tue Oct 6 03:44:33 2009 From: oleber at gmail.com (marcos rebelo) Date: Tue, 6 Oct 2009 12:44:33 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: References: Message-ID: <319d96980910060344i2be5dd34s72dc8be2282c732@mail.gmail.com> On Tue, Oct 6, 2009 at 12:38 PM, Paola Bisignano wrote: > yes I mean that they are not in the same order and I only need to > return the elements that are both in the two array > > 2009/10/6 Lally Blue : >> are the 2 arrays items in the same order? >> in the reference it says: >> "Internally the comparator compares the two arrays by using join to turn >> both arrays into strings and comparing the strings using eq." >> so I guess that if the first array has 1,2,3,4,5 and the second one >> 5,4,3,2,1 the Array::Compare returns false... >> is this what you mean? >> ? -Ilaria- >> On Tue, Oct 6, 2009 at 12:32 PM, Paola Bisignano >> wrote: >>> >>> Hi, >>> I have two lists of numbers, saved in two files and I want to compare >>> them, in order to check which are the same elements in both lists. I >>> put them into array, so I want to compare array, but I only want to >>> check the value, and It doesn't matter for the position in the array, >>> I tried to use Array::Compare >>> >>> >>> >>> open (OUT, "> $file"); >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?my $comp = Array::Compare-> new; >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($comp->compare(\@array_num1, >>> \@array_num2)) >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{ >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?print "$comp\n"; >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?print OUT "$comp\n"; >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?close OUT; >>> >>> but it returns blank, I don't know why... >>> _______________________________________________ >>> Milan-pm mailing list >>> Milan-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/milan-pm >> >> >> _______________________________________________ >> Milan-pm mailing list >> Milan-pm at pm.org >> http://mail.pm.org/mailman/listinfo/milan-pm >> >> > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > something like: use strict; use warnings; my %hash; open(my $FH_1, '<', '/file/path_1'); @hash{readline($FH_1)} = (); close $FH_1; open(my $FH_2, '<', '/file/path_2'); while (my $line = readline($FH_2)) { if ( exists $hash{$line} ) { print $line; } } close $FH_2; it will compare the numbers as strings, and print the repetitions. Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From oleber at gmail.com Tue Oct 6 03:49:56 2009 From: oleber at gmail.com (marcos rebelo) Date: Tue, 6 Oct 2009 12:49:56 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: <319d96980910060344i2be5dd34s72dc8be2282c732@mail.gmail.com> References: <319d96980910060344i2be5dd34s72dc8be2282c732@mail.gmail.com> Message-ID: <319d96980910060349q7e9b45c2x56e40ff36506f8c3@mail.gmail.com> On Tue, Oct 6, 2009 at 12:44 PM, marcos rebelo wrote: > On Tue, Oct 6, 2009 at 12:38 PM, Paola Bisignano > wrote: >> yes I mean that they are not in the same order and I only need to >> return the elements that are both in the two array >> >> 2009/10/6 Lally Blue : >>> are the 2 arrays items in the same order? >>> in the reference it says: >>> "Internally the comparator compares the two arrays by using join to turn >>> both arrays into strings and comparing the strings using eq." >>> so I guess that if the first array has 1,2,3,4,5 and the second one >>> 5,4,3,2,1 the Array::Compare returns false... >>> is this what you mean? >>> ? -Ilaria- >>> On Tue, Oct 6, 2009 at 12:32 PM, Paola Bisignano >>> wrote: >>>> >>>> Hi, >>>> I have two lists of numbers, saved in two files and I want to compare >>>> them, in order to check which are the same elements in both lists. I >>>> put them into array, so I want to compare array, but I only want to >>>> check the value, and It doesn't matter for the position in the array, >>>> I tried to use Array::Compare >>>> >>>> >>>> >>>> open (OUT, "> $file"); >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?my $comp = Array::Compare-> new; >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($comp->compare(\@array_num1, >>>> \@array_num2)) >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{ >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?print "$comp\n"; >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?print OUT "$comp\n"; >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?close OUT; >>>> >>>> but it returns blank, I don't know why... >>>> _______________________________________________ >>>> Milan-pm mailing list >>>> Milan-pm at pm.org >>>> http://mail.pm.org/mailman/listinfo/milan-pm >>> >>> >>> _______________________________________________ >>> Milan-pm mailing list >>> Milan-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/milan-pm >>> >>> >> _______________________________________________ >> Milan-pm mailing list >> Milan-pm at pm.org >> http://mail.pm.org/mailman/listinfo/milan-pm >> > > something like: > > > use strict; > use warnings; > > my %hash; > open(my $FH_1, '<', '/file/path_1'); > @hash{readline($FH_1)} = (); > close $FH_1; > > open(my $FH_2, '<', '/file/path_2'); > while (my $line = readline($FH_2)) { > ? ?if ( exists $hash{$line} ) { > ? ? ? ?print $line; > ? ?} > } > close $FH_2; > > > > it will compare the numbers as strings, and print the repetitions. > > Best Regards > Marcos Rebelo > > -- > Marcos Rebelo > http://oleber.freehostia.com > Milan Perl Mongers leader http://milan.pm.org > similar code using your arrays: my %hash; @hash{@array_num1} = (); open (my $OUT, '>', $file); foreach my $number (@array_num2) { if ( exists $hash{$number} ) { print "$number\n"; print $OUT "$number\n"; } } close $OUT; Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From stefano.rodighiero at gmail.com Tue Oct 6 03:55:39 2009 From: stefano.rodighiero at gmail.com (Stefano Rodighiero) Date: Tue, 6 Oct 2009 12:55:39 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: <319d96980910060349q7e9b45c2x56e40ff36506f8c3@mail.gmail.com> References: <319d96980910060344i2be5dd34s72dc8be2282c732@mail.gmail.com> <319d96980910060349q7e9b45c2x56e40ff36506f8c3@mail.gmail.com> Message-ID: <699026fb0910060355rc118b9av8a1e3a754866c33f@mail.gmail.com> On Tue, Oct 6, 2009 at 12:49 PM, marcos rebelo wrote: > my %hash; > @hash{@array_num1} = (); > > open (my $OUT, '>', $file); > > foreach my $number (@array_num2) { > ? ?if ( exists $hash{$number} ) { > ? ? ? ?print "$number\n"; > ? ? ? ?print $OUT "$number\n"; > ? ?} > } The hash approach is suitable for golfing :) [untested] delete @h{ @an2 }; print join "\n", keys @h; # you have the list of numbers not appearing in the second array Or, if you put the numbers as value as long as keys: print join "\n", delete @h{ @an2 }; # you have the list of numbers with repetitions s. -- www.stefanorodighiero.net From paola.bisignano at gmail.com Tue Oct 6 04:23:26 2009 From: paola.bisignano at gmail.com (Paola Bisignano) Date: Tue, 6 Oct 2009 13:23:26 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: <699026fb0910060355rc118b9av8a1e3a754866c33f@mail.gmail.com> References: <319d96980910060344i2be5dd34s72dc8be2282c732@mail.gmail.com> <319d96980910060349q7e9b45c2x56e40ff36506f8c3@mail.gmail.com> <699026fb0910060355rc118b9av8a1e3a754866c33f@mail.gmail.com> Message-ID: sorry, I want only repetitions... 2009/10/6 Stefano Rodighiero : > On Tue, Oct 6, 2009 at 12:49 PM, marcos rebelo wrote: > >> my %hash; >> @hash{@array_num1} = (); >> >> open (my $OUT, '>', $file); >> >> foreach my $number (@array_num2) { >> ? ?if ( exists $hash{$number} ) { >> ? ? ? ?print "$number\n"; >> ? ? ? ?print $OUT "$number\n"; >> ? ?} >> } > > > The hash approach is suitable for golfing :) > > [untested] > > delete @h{ @an2 }; > print join "\n", keys @h; # you have the list of numbers not appearing > in the second array > > Or, if you put the numbers as value as long as keys: > > print join "\n", delete @h{ @an2 }; # you have the list of numbers > with repetitions > > s. > > -- > www.stefanorodighiero.net > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > From casati_gianluca at yahoo.it Tue Oct 6 05:47:41 2009 From: casati_gianluca at yahoo.it (Gianluca Casati) Date: Tue, 6 Oct 2009 12:47:41 +0000 (GMT) Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <319d96980910060027q7469d8f4t6a159d30f39e9386@mail.gmail.com> References: <319d96980909200157q693c8d48wffbd5eecd186f89d@mail.gmail.com> <319d96980910060027q7469d8f4t6a159d30f39e9386@mail.gmail.com> Message-ID: <311067.48314.qm@web27905.mail.ukl.yahoo.com> Hi, I think la fabbrica is ok! ________________________________ Da: marcos rebelo A: milan-pm at pm.org Inviato: Marted? 6 ottobre 2009, 9:27:36 Oggetto: Re: [Milan-pm] October Monthly Meeting On Sun, Sep 20, 2009 at 10:57 AM, marcos rebelo wrote: > Hi all > > Time to get the October Monthly Meeting. > http://www.doodle.com/pwp7kp6282mpx5um > > Best Regards > Marcos Rebelo > > -- > Marcos Rebelo > http://oleber.freehostia.com > Milan Perl Mongers leader http://milan.pm.org > Let's make it Thursday, at 21h, to get most of the persons satisfied. Where shall we go? La Fabrica or someone else have a different idea? Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org _______________________________________________ Milan-pm mailing list Milan-pm at pm.org http://mail.pm.org/mailman/listinfo/milan-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: From oha at oha.it Tue Oct 6 05:51:39 2009 From: oha at oha.it (Oha) Date: Tue, 06 Oct 2009 14:51:39 +0200 Subject: [Milan-pm] comparing 2 lists Message-ID: <200910061251.n96CpdO1013929@vivaldi21.register.it> >The hash approach is suitable for golfing :) going OT, i think more golfer is the *nix aproach: sort file1 file2 | uniq -u but require that every entry is not repeated in the same file! Oha From gbjgiulio at gmail.com Tue Oct 6 06:09:40 2009 From: gbjgiulio at gmail.com (Giulio Bertani) Date: Tue, 6 Oct 2009 15:09:40 +0200 Subject: [Milan-pm] October Monthly Meeting Message-ID: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> Hi to all, sorry but this week I can't be there Can we meet in the next week, for example On Thursday, October 13, 2009? Sorry again Giulio -- Giulio Bertani www.perquelliche.it (In definizione ...) -------------- next part -------------- An HTML attachment was scrubbed... URL: From casati_gianluca at yahoo.it Tue Oct 6 06:12:00 2009 From: casati_gianluca at yahoo.it (Gianluca Casati) Date: Tue, 6 Oct 2009 13:12:00 +0000 (GMT) Subject: [Milan-pm] comparing 2 lists In-Reply-To: References: Message-ID: <869038.52724.qm@web27908.mail.ukl.yahoo.com> #Hi Paola, #this is the way I would do it, hope it can help. use strict; # le due liste, che tu leggerai dai file, qua le ho valorizzate a caso per fare delle prove. my @list1 = ( 1,2,3); my @list2 = (2,3,4); # questo hash lo uso per contare quante volte mi si presenta un valore. my %count; # lista che conterr? i numeri in comune. my @common; # ciclo sulle due liste. for my $num ( @list1 , @list2 ) { # ogni valore delle liste lo metto come chiave dell' hash e aggiungo 1, cos? conto quante volte ho trovato il numero. $count{$num}++; } for my $num ( keys %count ) { # ciclo sulle chiavi dell' hash e metto i numeri che ho trovato pi? di una volta, nella lista @common. push( @common , $num ) if $count{$num} > 1; } # ti lascio la print, se vuoi stampare il risultato. #print "$_\n" for @common; ________________________________ Da: Paola Bisignano A: milan-pm at pm.org Inviato: Marted? 6 ottobre 2009, 12:32:08 Oggetto: [Milan-pm] comparing 2 lists Hi, I have two lists of numbers, saved in two files and I want to compare them, in order to check which are the same elements in both lists. I put them into array, so I want to compare array, but I only want to check the value, and It doesn't matter for the position in the array, I tried to use Array::Compare open (OUT, "> $file"); my $comp = Array::Compare-> new; if ($comp->compare(\@array_num1, \@array_num2)) { print "$comp\n"; print OUT "$comp\n"; } close OUT; but it returns blank, I don't know why... _______________________________________________ Milan-pm mailing list Milan-pm at pm.org http://mail.pm.org/mailman/listinfo/milan-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleber at gmail.com Tue Oct 6 09:05:28 2009 From: oleber at gmail.com (marcos rebelo) Date: Tue, 6 Oct 2009 18:05:28 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> References: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> Message-ID: <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> 2009/10/6 Giulio Bertani : > Hi to all, > sorry but this week I can't be there > Can we meet?in the next week, for example?On Thursday,?October 13, 2009? > Sorry again > Giulio > -- > Giulio Bertani > www.perquelliche.it (In definizione ...) > > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > > For me it's ok next week. Time to get the October Monthly Meeting. http://www.doodle.com/pwp7kp6282mpx5um -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From oleber at gmail.com Tue Oct 6 09:09:13 2009 From: oleber at gmail.com (marcos rebelo) Date: Tue, 6 Oct 2009 18:09:13 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: <869038.52724.qm@web27908.mail.ukl.yahoo.com> References: <869038.52724.qm@web27908.mail.ukl.yahoo.com> Message-ID: <319d96980910060909p4540ddf6pb1fa46e8caaedcbd@mail.gmail.com> 2009/10/6 Gianluca Casati : > > #Hi Paola, > #this is the way I would do it, hope it can help. > > use strict; > > # le due liste, che tu leggerai dai file, qua le ho valorizzate a caso per > fare delle prove. > my @list1 = ( 1,2,3); > my @list2 = (2,3,4); try it with my @list1 = ( 1, 1,2,3); my @list2 = (2,3,4); > > # questo hash lo uso per contare quante volte mi si presenta un valore. > my %count; > > # lista che conterr? i numeri in comune. > my @common; > > # ciclo sulle due liste. > for my $num ( @list1 , @list2 ) > { > # ogni valore delle liste lo metto come chiave dell' hash e aggiungo 1, cos? > conto quante volte ho trovato il numero. > $count{$num}++; > } > > for my $num ( keys %count ) > { > # ciclo sulle chiavi dell' hash e metto i numeri che ho trovato pi? di una > volta, nella lista @common. > push( @common , $num ) if $count{$num} > 1; > } > > # ti lascio la print, se vuoi stampare il risultato. > #print "$_\n" for @common; > > > > > ________________________________ > Da: Paola Bisignano > A: milan-pm at pm.org > Inviato: Marted? 6 ottobre 2009, 12:32:08 > Oggetto: [Milan-pm] comparing 2 lists > > Hi, > I have two lists of numbers, saved in two files and I want to compare > them, in order to check which are the same elements in both lists. I > put them into array, so I want to compare array, but I only want to > check the value, and It doesn't matter for the position in the array, > I tried to use Array::Compare > > > > open (OUT, "> $file"); > ??? ??? ??? ??? ??? my $comp = Array::Compare-> new; > ??? ??? ??? ??? ??? if ($comp->compare(\@array_num1, \@array_num2)) > ??? ??? ??? ??? ??? ??? { > ??? ??? ??? ??? ??? ??? print "$comp\n"; > ??? ??? ??? ??? ??? ??? print OUT "$comp\n"; > ??? ??? ??? ??? ??? ??? } > ??? ??? ??? ??? ??? close OUT; > > but it returns blank, I don't know why... > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > > > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > > -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From mb at cattlegrid.info Tue Oct 6 11:16:03 2009 From: mb at cattlegrid.info (Michele Beltrame) Date: Tue, 06 Oct 2009 20:16:03 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: References: Message-ID: <4ACB8963.8090008@cattlegrid.info> Ciao Paola! Indico ancora un altro modo: ---- use Set::Object qw/set/; my $set1 = set(3, 5, 8, 2, 20); my $set2 = set(40, 2, 81, 20, 3); my $intersection = $set1 * $set2; print join ',', @$intersection; ---- A presto, Michele. -- Michele Beltrame http://www.italpro.net/ - mb at italpro.net SkyPe: arthas77 - Twitter: _arthas From mb at cattlegrid.info Tue Oct 6 11:22:45 2009 From: mb at cattlegrid.info (Michele Beltrame) Date: Tue, 06 Oct 2009 20:22:45 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: <4ACB8963.8090008@cattlegrid.info> References: <4ACB8963.8090008@cattlegrid.info> Message-ID: <4ACB8AF5.60606@cattlegrid.info> Ciao! Se in effetti devi comparare 2 file disordinati e capire solo quali entry ci sono sia nell'uno che nell'altro, ponendo siano una per riga, c'? anche questa semplice soluzione non-Perlish: grep -x -f file1.txt file2.txt Serve Unix. :-) A presto, Michele. -- Michele Beltrame http://www.italpro.net/ - mb at italpro.net SkyPe: arthas77 - Twitter: _arthas From paola.bisignano at gmail.com Wed Oct 7 01:18:50 2009 From: paola.bisignano at gmail.com (Paola Bisignano) Date: Wed, 7 Oct 2009 10:18:50 +0200 Subject: [Milan-pm] comparing 2 lists In-Reply-To: <4ACB8AF5.60606@cattlegrid.info> References: <4ACB8963.8090008@cattlegrid.info> <4ACB8AF5.60606@cattlegrid.info> Message-ID: grazie, adoro le soluzioni unix!!!non ci avevo pensato... :-) A volte cerco di evitarle, perch? se devo scrivere un programma che giri ovunque, ma confesso di aver ricorso spesso a queste....e mi sa che prima o poi dovr? ripulire il mio codice.... :-( grazie a tutti!!! Il 06 ottobre 2009 20.22, Michele Beltrame ha scritto: > Ciao! > > Se in effetti devi comparare 2 file disordinati e capire solo quali entry ci > sono sia nell'uno che nell'altro, ponendo siano una per riga, c'? anche > questa semplice soluzione non-Perlish: > > grep -x -f file1.txt file2.txt > > Serve Unix. :-) > > A presto, > Michele. > > -- > Michele Beltrame > http://www.italpro.net/ - mb at italpro.net > SkyPe: arthas77 - Twitter: _arthas > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > From paola.bisignano at gmail.com Wed Oct 7 05:58:21 2009 From: paola.bisignano at gmail.com (Paola Bisignano) Date: Wed, 7 Oct 2009 14:58:21 +0200 Subject: [Milan-pm] comandi unix Message-ID: sto cercando di rimuovere tutti i comandi unix dal mio script, qualcuno sa se esiste un analogo di "paste" in perl? perch? devo "affiancare 2 file, non accodarli" grazie ciao a tutti From oha at oha.it Wed Oct 7 08:02:10 2009 From: oha at oha.it (Oha) Date: Wed, 07 Oct 2009 17:02:10 +0200 Subject: [Milan-pm] comandi unix Message-ID: <200910071502.n97F2AC0017727@vivaldi46.register.it> >qualcuno sa se esiste un analogo di "paste" in perl? untested: join "t", map { defined $_ ? $_ : 'EOF' } (<$fh1>, <$fh2>); Oha From oleber at gmail.com Wed Oct 7 08:19:36 2009 From: oleber at gmail.com (marcos rebelo) Date: Wed, 7 Oct 2009 17:19:36 +0200 Subject: [Milan-pm] comandi unix In-Reply-To: References: Message-ID: <319d96980910070819mdc592ebmb7c86a2e1fdc8698@mail.gmail.com> 2009/10/7 Paola Bisignano : > sto cercando di rimuovere tutti i comandi unix dal mio script, > qualcuno sa se esiste un analogo di "paste" in perl? perch? devo > "affiancare 2 file, non accodarli" > > > grazie > > ciao a tutti > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > Try use strict; use warnings; use v5.10; use autodie qw(:all); open(my $FH_LEFT, '/path/to/left/file'); open(my $FH_RIGHT, '/path/to/right/file'); while (defined(my $line_left = <$FH_LEFT>) or defined(my $line_right = <$FH_RIGHT>)) { $line_left //= ''; $line_right //= ''; say($line_left,"\t", $line_right); } close $FH_LEFT; close $FH_RIGHT; Best Regards MArcos -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From oleber at gmail.com Thu Oct 8 05:36:51 2009 From: oleber at gmail.com (marcos rebelo) Date: Thu, 8 Oct 2009 14:36:51 +0200 Subject: [Milan-pm] Creating a SQLite DB and loading a schema In-Reply-To: <319d96980910080534n5fe741cxa84ff147907ec8db@mail.gmail.com> References: <319d96980910080534n5fe741cxa84ff147907ec8db@mail.gmail.com> Message-ID: <319d96980910080536s42ca2d66n49c4cdc4e3d2f101@mail.gmail.com> Hi all I need to define and test a SQLite Data Base in disk and in memory. - I need to load the schema in the __DATA__ area into the data base. - I need to create a foreign key in user.organization_id to organization.organization_id How do I solve this? use strict; use warnings; use v5.10; use Data::Dumper; use DBI; my $dbh = DBI->connect("dbi:SQLite:dbname=db.sqlite", "", ""); $/ = undef; $dbh->do() or die $dbh->errstr; say 'END'; __DATA__ DROP TABLE IF EXISTS organization; CREATE TABLE IF NOT EXISTS organization ( ? ?organization_id VARCHAR PRIMARY KEY NOT NULL, ? ?email VARCHAR NOT NULL ); -- DROP TABLE IF EXISTS user; CREATE TABLE IF NOT EXISTS user ( ? ?email VARCHAR PRIMARY KEY ?NOT NULL, ? ?organization_id VARCHAR NOT NULL -- Foreign key ); -- DROP TABLE IF EXISTS organization_document_type; CREATE TABLE IF NOT EXISTS organization_document_type ( ? ?organization_id VARCHAR PRIMARY KEY NOT NULL, ? ?document_type ? ? ? ? ? VARCHAR NOT NULL, ? ?letter_color ? ? ? ? ? ?VARCHAR NOT NULL, ? ?letter_print_both_sides INTEGER NOT NULL, ? ?letter_type ? ? ? ? ? ? VARCHAR NOT NULL, ? ?email_form ? ? ? ? ? ? ?VARCHAR NOT NULL, ? ?email_subject ? ? ? ? ? VARCHAR NOT NULL, ? ?email_body ? ? ? ? ? ? ?VARCHAR NOT NULL ); CREATE TRIGGER insert__organization_document_type__letter_color BEFORE INSERT ON organization_document_type FOR EACH ROW BEGIN ? ? ?SELECT RAISE(ROLLBACK, 'organization_document_type.letter_color invalid') ? ? ?WHERE ?NEW.letter_color NOT IN ( 'BW', 'COLOR' ); END; CREATE TRIGGER update__organization_document_type__letter_color BEFORE UPDATE OF letter_color ON organization_document_type FOR EACH ROW BEGIN ? ? ?SELECT RAISE(ROLLBACK, 'organization_document_type.letter_color invalid') ? ? ?WHERE ?NEW.letter_color NOT IN ( 'BW', 'COLOR' ); END; Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From oleber at gmail.com Mon Oct 12 08:02:35 2009 From: oleber at gmail.com (marcos rebelo) Date: Mon, 12 Oct 2009 17:02:35 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> References: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> Message-ID: <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> On Tue, Oct 6, 2009 at 6:05 PM, marcos rebelo wrote: > 2009/10/6 Giulio Bertani : >> Hi to all, >> sorry but this week I can't be there >> Can we meet?in the next week, for example?On Thursday,?October 13, 2009? >> Sorry again >> Giulio >> -- >> Giulio Bertani >> www.perquelliche.it (In definizione ...) >> >> _______________________________________________ >> Milan-pm mailing list >> Milan-pm at pm.org >> http://mail.pm.org/mailman/listinfo/milan-pm >> >> > > For me it's ok next week. > > Time to get the October Monthly Meeting. > http://www.doodle.com/pwp7kp6282mpx5um > > -- > Marcos Rebelo > http://oleber.freehostia.com > Milan Perl Mongers leader http://milan.pm.org > Let's do it on the 14 of October at 21h in La Fabricca. Hopping to find you there. Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From gbjgiulio at gmail.com Mon Oct 12 12:58:32 2009 From: gbjgiulio at gmail.com (Giulio Bertani) Date: Mon, 12 Oct 2009 21:58:32 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> References: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> Message-ID: <4c4b91ff0910121258p2a31b832g547be37cc4c29693@mail.gmail.com> Sorry for late answer ... for me it's OK !!! see you soon 14 of October at 21h in La Fabbrica della pizza. 2009/10/12 marcos rebelo > On Tue, Oct 6, 2009 at 6:05 PM, marcos rebelo wrote: > > 2009/10/6 Giulio Bertani : > >> Hi to all, > >> sorry but this week I can't be there > >> Can we meet in the next week, for example On Thursday, October 13, 2009? > >> Sorry again > >> Giulio > >> -- > >> Giulio Bertani > >> www.perquelliche.it (In definizione ...) > >> > >> _______________________________________________ > >> Milan-pm mailing list > >> Milan-pm at pm.org > >> http://mail.pm.org/mailman/listinfo/milan-pm > >> > >> > > > > For me it's ok next week. > > > > Time to get the October Monthly Meeting. > > http://www.doodle.com/pwp7kp6282mpx5um > > > > -- > > Marcos Rebelo > > http://oleber.freehostia.com > > Milan Perl Mongers leader http://milan.pm.org > > > > Let's do it on the 14 of October at 21h in La Fabricca. > > Hopping to find you there. > > Best Regards > Marcos Rebelo > > > -- > Marcos Rebelo > http://oleber.freehostia.com > Milan Perl Mongers leader http://milan.pm.org > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > -- Giulio Bertani www.perquelliche.it (In definizione ...) -------------- next part -------------- An HTML attachment was scrubbed... URL: From mb at cattlegrid.info Mon Oct 12 15:08:54 2009 From: mb at cattlegrid.info (Michele Beltrame) Date: Tue, 13 Oct 2009 00:08:54 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <4c4b91ff0910121258p2a31b832g547be37cc4c29693@mail.gmail.com> References: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> <4c4b91ff0910121258p2a31b832g547be37cc4c29693@mail.gmail.com> Message-ID: <4AD3A8F6.1010502@cattlegrid.info> Hi! > Sorry for late answer ... for me it's OK !!! > see you soon 14 of October at 21h in La Fabbrica della pizza. Be sure to convince as many folks as possible to come to Italian Perl Workshop next week!!! Thanks, Michele. -- Michele Beltrame http://www.italpro.net/ - mb at italpro.net SkyPe: arthas77 - Twitter: _arthas From minimal.oasis+milan-pm at gmail.com Mon Oct 12 17:28:25 2009 From: minimal.oasis+milan-pm at gmail.com (Max M) Date: Tue, 13 Oct 2009 02:28:25 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <4AD3A8F6.1010502@cattlegrid.info> References: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> <4c4b91ff0910121258p2a31b832g547be37cc4c29693@mail.gmail.com> <4AD3A8F6.1010502@cattlegrid.info> Message-ID: <3f9c3baf0910121728l4d3ceae8h461a5bdf6bd027b5@mail.gmail.com> On Tue, Oct 13, 2009 at 00:08, Michele Beltrame wrote: > Be sure to convince as many folks as possible to come to Italian Perl > Workshop next week!!! At least half of the people taking part in the meeting are indeed going to the IPW. MM From oha at oha.it Tue Oct 13 08:46:12 2009 From: oha at oha.it (Oha) Date: Tue, 13 Oct 2009 17:46:12 +0200 Subject: [Milan-pm] October Monthly Meeting Message-ID: <200910131546.n9DFkC6T023293@vivaldi40.register.it> >> Be sure to convince as many folks as possible to come to Italian Perl >> Workshop next week!!! >At least half of the people taking part in the meeting are indeed >going to the IPW. try to convince the other half then! :) Oha From gbjgiulio at gmail.com Wed Oct 14 05:06:20 2009 From: gbjgiulio at gmail.com (Giulio Bertani) Date: Wed, 14 Oct 2009 14:06:20 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> References: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> Message-ID: <4c4b91ff0910140506r15b38127v3e6055e2169e941e@mail.gmail.com> Hi to all, is the dinner confirmed for this evening? La cena di questa sera ? confermata? Ciao Giulio 2009/10/12 marcos rebelo oleber at gmail.com > > > Let's do it on the 14 of October at 21h in La Fabricca. > > Hopping to find you there. > > Best Regards > Marcos Rebelo > > > -- > Marcos Rebelo > http://oleber.freehostia.com > Milan Perl Mongers leader http://milan.pm.org > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > -- Giulio Bertani www.perquelliche.it (In definizione ...) -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleber at gmail.com Wed Oct 14 05:24:30 2009 From: oleber at gmail.com (marcos rebelo) Date: Wed, 14 Oct 2009 14:24:30 +0200 Subject: [Milan-pm] October Monthly Meeting In-Reply-To: <4c4b91ff0910140506r15b38127v3e6055e2169e941e@mail.gmail.com> References: <4c4b91ff0910060609n5ceb1af5rbe676ce4950f5d1c@mail.gmail.com> <319d96980910060905s2bc6fc5o5ab16fdfe40ae240@mail.gmail.com> <319d96980910120802u2c2c2e73i607fd52154fc2a83@mail.gmail.com> <4c4b91ff0910140506r15b38127v3e6055e2169e941e@mail.gmail.com> Message-ID: <319d96980910140524p5e96079bnef2646cb985b481@mail.gmail.com> Yes in la Fabricca 2009/10/14 Giulio Bertani : > Hi to all, > is the dinner confirmed for this evening? > > La cena di questa sera ? confermata? > Ciao > Giulio > 2009/10/12 marcos rebelo oleber at gmail.com >> >> >> Let's do it on the 14 of October at 21h in La Fabricca. >> >> Hopping to find you there. >> >> Best Regards >> Marcos Rebelo >> >> >> -- >> Marcos Rebelo >> http://oleber.freehostia.com >> Milan Perl Mongers leader http://milan.pm.org >> _______________________________________________ >> Milan-pm mailing list >> Milan-pm at pm.org >> http://mail.pm.org/mailman/listinfo/milan-pm > > > > -- > Giulio Bertani > www.perquelliche.it (In definizione ...) > > _______________________________________________ > Milan-pm mailing list > Milan-pm at pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > > -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org From oleber at gmail.com Tue Oct 27 00:20:51 2009 From: oleber at gmail.com (marcos rebelo) Date: Tue, 27 Oct 2009 08:20:51 +0100 Subject: [Milan-pm] Milan PM November Monthly Meeting Message-ID: <319d96980910270020w734aae81la2d972a7522f6c17@mail.gmail.com> As usual we have the pizza in the first week of the month, let's try to chose the best day to all. http://www.doodle.com/upau6tcg2mqzpddy This month we may comment on the IPW done in Pisa. Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org