I am trying to get my mind around using fork()

I have a text file that has solid, liquid, and gas on it all on new
lines, how I understand fork() is if I wanted to do a print each
statement on each line in the file, fork() could do all at once with
parent and child processes.

I can get around doing this with a while loop i.e

#!/usr/bin/perl
use strict;
use warnings;

open(FILE, "text1.txt");

while (my $line = <FILE>) {
 print " The current state is $line"."\n";

}

How could I achieve the same with fork() ?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to