[Milan-pm] comandi unix

marcos rebelo oleber at gmail.com
Wed Oct 7 08:19:36 PDT 2009


2009/10/7 Paola Bisignano <paola.bisignano at gmail.com>:
> 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


More information about the Milan-pm mailing list