grashoper has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use win32::OLE qw(in); $search="Vuser Terminated"; open(INFO, "E:\\Mibor_TimingTest\\Mibor\\output.txt"); @array=<INFO>; close (INFO); foreach $line(@array){ if ($line =~ /$search/) { print "found $line"; $i=1; open(COUNT, ">>","c:\\perl\\scripts\\counter.txt")|| die "I cannot ope +n the file"; print (COUNT "$i"); @array2=<COUNT>; foreach $line(@array2){ if ($line) { print (COUNT "$i++"); close(COUNT); } else { print "$line \n"; } } run_code; my $error = run_code('c:\\perl\\scripts\\killp.pl'); print "Run code failed, err msg:\n$error" if $error; # # add error handling code here for if vugen fails to die.. # # # sub run_code { $path="c:\\perl\\scripts"; my $path = shift; open(CODE, $path) || return "Oops: $path $!\n"; local $/; my $code = <CODE>; eval $code; return $@; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print to file not working
by ikegami (Patriarch) on Apr 20, 2009 at 17:25 UTC | |
|
Re: print to file not working
by Anonymous Monk on Apr 21, 2009 at 06:39 UTC | |
by grashoper (Monk) on Apr 21, 2009 at 15:01 UTC | |
by Anonymous Monk on Apr 22, 2009 at 07:00 UTC |