how would I use this approach to add newlines after every record in the file (i.e. after every 320 characters)?Take advantage of the $/ variable
{ open(my $data, '<', "data_file") or die("ack - $!"); open(my $out, '>', "out_file") or die("ack - $!"); local $/ = \320; while(<$data>) { chomp; print $out $_ . "\n"; } }
_________
broquaint
In reply to Re: Re: Re: Insert at regular increments
by broquaint
in thread Insert at regular increments
by EyeOpener
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |