chomp($phi = `ls slk`);
chomp($phi2 = `ls *.csv`);
open(OUT,"> /home/Aug18.csv") or die "Cannot open output file;
open(READDATA, "< /home/$phi") or die "Cannot Open file;
####
@phi2 = `ls *.csv`;
chomp @phi2; # chomp will apply to every element of the array
####
your_script.pl slk someinput.csv > /home/Aug18.csv
####
#!/usr/bin/perl -w
use strict;
die "Usage: $0 infile1 infile2\n" unless (@ARGV==2 and -f $ARGV[0]);
my ($infile1, $infile2) = @ARGV;
open( READDATA, $infile1 ) or die "Cannot open $infile1: $!\n";
my %h = ();
while ()
{
if ( /(\d{4}\w\d?)\s+(\w*)/ ){
my ( $port, $lsn ) = ( $1, $2 );
$h{$port} = $lsn;
}
}
close READDATA;
open( READDATA2, $infile2 ) or die "Cannot open $infile2: $!\n";
while ()
{
chomp;
if ( /(\d{4}\w\d?)/ and exists( $h{$1} )) {
print "$_,$h{$1}\n";
}
}