RosettaCodeData/Task/Fixed-length-records/Perl/fixed-length-records-1.pl
2023-07-01 13:44:08 -04:00

8 lines
317 B
Raku

open $in, '<', 'flr-infile.dat';
open $out, '>', 'flr-outfile.dat';
while ($n=sysread($in, $record, 80)) { # read in fixed sized binary chunks
syswrite $out, reverse $record; # write reversed records to file
print reverse($record)."\n" # display reversed records, line-by-line
}
close $out;