CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: How to give input files as loop inside perl script?: Edit Log



lecria
New User

Jul 26, 2012, 9:55 AM


Views: 917
How to give input files as loop inside perl script?

I am using below script to compare two files UEDP35.txt and BB_UEDP35.txt. This script work well if i give inputs manually. Now i need something more. anyone please help.

Inside one folder i have n numbers of files same like UEDP35.txt. for eg: UEDP1.txt,UEDP2.txt,UEDP3.txt... Same like another file BB_UEDP35.txt for eg: BB_UEDP1.txt,BB_UEDP2.txt,BB_UEDP3.txt... here UEDP is common is both files name. If this UEDP are same, then i want to give those two files as inputs. If any different occur while comparing then that has to export into another new file. This has to be done as loop.

use warnings;

use strict;

open AIN, "<UEDP35.txt ";

open BIN, "<BB_UEDP35.csv";

my %seen;

while (<ain>) {

my $v = (split(/,/))[0];

$seen{$v}++;

}

while (<bin>) {

my $v=(split)[0];

print "$vn" if not $seen{substr($v, 0, 5)};

}

close AIN;

close BIN;

(This post was edited by lecria on Jul 26, 2012, 9:57 AM)


Edit Log:
Post edited by lecria (New User) on Jul 26, 2012, 9:57 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives