RE: joining lines

2004-04-23 Thread Jan Eden
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

splitting files (was Re: Joining Lines.)

2004-04-23 Thread WC -Sx- Jones
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

RE: joining lines

2004-04-23 Thread Charles K. Clarkson
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

Re: joining lines

2004-04-23 Thread Jan Eden
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

Re: joining lines

2004-04-23 Thread Jeff 'japhy' Pinyan
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

RE: joining lines

2004-04-23 Thread Charles K. Clarkson
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

joining lines

2004-04-23 Thread Kimberly Schramm
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