in reply to Re: Re: Insert at regular increments
in thread Insert at regular increments
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Insert at regular increments
by sauoq (Abbot) on Jul 22, 2002 at 22:32 UTC | |
by EyeOpener (Scribe) on Jul 23, 2002 at 00:13 UTC | |
by broquaint (Abbot) on Jul 23, 2002 at 13:37 UTC | |
by Aristotle (Chancellor) on Jul 23, 2002 at 14:12 UTC | |
by sauoq (Abbot) on Jul 23, 2002 at 19:21 UTC | |
|
Re: Re: Re: Re: Insert at regular increments
by EyeOpener (Scribe) on Jul 22, 2002 at 22:01 UTC |