#!/usr/bin/perl #file: plet_test.pl use strict; use warnings; use Data::Dumper; $|=1; &do_something(@ARGV); exit 0; sub do_something { open(FILE,'<',$_[0]) || die; my $line=; print "$line\n"; } #### #! /usr/bin/perl #file: call_stuff.pl use strict; use warnings; use Tie::File; $|=1; for(my $i=1;$i<=10;$i++){ my @array=(); tie(@array,'Tie::File',"my_file.txt"); $array[1]="this is a line!"; $array[2]="woah, another line"; $array[3]="more lines??"; $array[4]="and so on...."; $array[0]="this is the first line. it is number $i. haha!"; untie(@array); system('./plet_test.pl my_file.txt &'); } exit 0; #### this is the first line. it is number 2. haha! this is the first line. it is number 4. haha! this is the first line. it is number 5. haha! this is the first line. it is number 6. haha! this is the first line. it is number 7. haha! this is the first line. it is number 8. haha! this is the first line. it is number 9. haha! this is the first line. it is number 10. haha! this is the first line. it is number 10. haha! this is the first line. it is number 10. haha!