If i run the below code it does not right to the voucher.rtf file.
Can you guide on the best way to accomplish this.
#!/usr/bin/perl
use warnings;
use strict;
my ($pin, $pin1, $pin2, $val);
format MINE=
Voucher @<<< Voucher @<<< Voucher @<<<
$val, $val, $val,
PIN @<<<<<<<<<<<<< PIN @<<<<<<<<<<<<< PIN @<<<<<<<<<<<<<
$pin, $pin1, $pin2,
.
my $outvou = '/perl/mycode/progperl/voucher.rtf';
#open the file voucher.rtf for inputs
open TESTFILE, "+>", $outvou or die "cannot open $outvou:$!";
my $testpins = '/perl/mycode/progperl/testpins.txt';
#open the file testpins.txt for reading
open my $fh, '<', $testpins or die "cannot open $testpins:$!";
my $c;
my @result = <$fh>;
my @pin;
for(@result){
my @line = (split/ /);
push @pin, $line[0] if $line[1] =~/200acct/
}
for($c=0; $c <= $#pin; $c++){
$pin = $pin[$c];
$pin1 = $pin[$c=$c+1];
$pin2 = $pin[$c=$c+1];
$val = 200;
select(TESTFILE);
$~ = "MINE";
write;
}
close $fh;
close (TESTFILE);
extract from testpins.txt
==========================
5467054961946 200acct
5518935606936 200acct
5559810038657 100acct
5840143221892 200acct
5604116723026 200acct
5490024283962 200acct
5657499629585 200acct
5899894585741 200acct
5750426282431 200acct
5939183545596 200acct
5621825327200 200acct
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/