0

is it possible to open and work in two files from same or different location simultaneously.

How it is possible? Please suggest

Thanks / Regards
Mahesh

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by mitchems
0

is it possible to open and work in two files from same or different location simultaneously.

How it is possible? Please suggest

Thanks / Regards
Mahesh

Yes it is possible. How? When you open a file you assign it to a file handle which you give any name you want. You can open another file and assign it to a file handle with a different name. You can read more about opening files here

0
open(IN,"<","input.txt");
open(OUT,">","output.txt");
while(<IN>){
  chomp;
  #do something with IN
  print OUT "something to OUT\n";
}

My laptop freaked out and I posted twice. Sorry.

Edited by mitchems: n/a

0
open(IN,"<","input.txt");
open(OUT,">","output.txt");
while(<IN>){
  chomp;
  #do something with IN
  print OUT "something to OUT\n";
}

Edited by mitchems: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.