Charles K. Clarkson wrote on 23.04.2004:
>Jan Eden <[EMAIL PROTECTED]> wrote:
>:
>: Jeff 'japhy' Pinyan wrote on 23.04.2004:
>:
>: ># read 6 lines from IN and put them in @record
>: >my @record = map scalar(), 1 .. 6;
>:
>: How does this work?
>:
>: In the map function you gave, the fi
Jeff 'japhy' Pinyan wrote:
my @record = map scalar(), 1 .. 6;
It's a neat trick :)
Same trick, but to split up *any text* files -
#! /usr/local/bin/perl
use strict;
use warnings;
# Example command:
# perl split_files syslog [3]
# where [] is an optional number of files to sp
Jan Eden <[EMAIL PROTECTED]> wrote:
:
: Jeff 'japhy' Pinyan wrote on 23.04.2004:
:
: ># read 6 lines from IN and put them in @record
: >my @record = map scalar(), 1 .. 6;
:
: How does this work?
:
: In the map function you gave, the first argument is scalar,
: which takes only one argu
Jeff 'japhy' Pinyan wrote on 23.04.2004:
># read 6 lines from IN and put them in @record
>my @record = map scalar(), 1 .. 6;
How does this work?
In the map function you gave, the first argument is scalar, which takes only one
argument and returns a line from INPUT in scalar context. But
On Apr 23, Kimberly Schramm said:
>I have a file that is 300+ lines long containing data for an event. each
>event takes up 6 lines. I would like to join the 6 lines, so that each
>event is only one line. Is this possible in perl?
Sure. Here's how I'd go about doing it:
open IN, "< file.tx
Kimberly Schramm <[EMAIL PROTECTED]> wrote:
:
: I have a file that is 300+ lines long containing data
: for an event. each event takes up 6 lines. I would
: like to join the 6 lines, so that each event is only
: one line. Is this possible in perl?
Yes, you can use the 'join' function for t
I have a file that is 300+ lines long containing data for an event. each
event takes up 6 lines. I would like to join the 6 lines, so that each
event is only one line. Is this possible in perl?
Thanks for your help!
~
"That