Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Nested While loop not working

by vinoth.ree (Prior)
on Mar 11, 2014 at 09:43 UTC ( #1077823=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Nested While loop not working
in thread Nested While loop not working

No, Your code is working for me without removing the second loop.

use strict; use warnings; open(file_one,"<","ABC")or die $!; while(my $line = <file_one>) { open(file_two,"<","CDE") or die $!; while(my $line2=<file_two>) { print "line : $line line2 : $line2 \n"; } close(file_two); }

line : test
line2 : CDE

line : test
line2 : CDEEE

line : test
line2 : CDEEEE

line : test121212121
line2 : CDE

line : test121212121
line2 : CDEEE

line : test121212121
line2 : CDEEEE

line : adskjdsadjdka
line2 : CDE

line : adskjdsadjdka
line2 : CDEEE

line : adskjdsadjdka
line2 : CDEEEE

Update:

Added file content.

ABC:

test
test121212121
adskjdsadjdka

CDE:

CDE
CDEEE
CDEEEE


All is well


Comment on Re^3: Nested While loop not working
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1077823]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2015-07-29 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (268 votes), past polls