Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Uri Guttman
> "BM" == Brandon McCaig writes: BM> On Fri, Sep 16, 2011 at 2:55 PM, Paul Johnson wrote: >> map EXPR, @a is just the same as map { EXPR } @a. BM> The part that I find confusing is that EXPR is evaluated against each BM> $_, as opposed to once when map is called, passing the resulti

Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Uri Guttman
> "PJ" == Paul Johnson writes: PJ> On Fri, Sep 16, 2011 at 02:27:08PM -0400, Brandon McCaig wrote: >> my @column_headers = map trim($_), split /\|/, $header_line; >> Using an EXPR with map is even more confusing to me, but it seems to >> work here so I'll leave it at that. ;D PJ>

Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Brandon McCaig
On Fri, Sep 16, 2011 at 2:55 PM, Paul Johnson wrote: > map EXPR, @a is just the same as map { EXPR } @a. The part that I find confusing is that EXPR is evaluated against each $_, as opposed to once when map is called, passing the resulting value into map. :) Obviously it's just one of the many ma

Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Paul Johnson
On Fri, Sep 16, 2011 at 02:27:08PM -0400, Brandon McCaig wrote: > my @column_headers = map trim($_), split /\|/, $header_line; > Using an EXPR with map is even more confusing to me, but it seems to > work here so I'll leave it at that. ;D map EXPR, @a is just the same as map { EXPR } @a. Some

Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Jim Gibson
On 9/16/11 Fri Sep 16, 2011 11:27 AM, "Brandon McCaig" scribbled: > On Fri, Sep 16, 2011 at 11:32 AM, Brandon McCaig wrote: >>    my @column_headers = map { $_ = trim($_); $_; } >>            split /\|/, $header_line; > > Sorry, that should be: > > my @column_headers = map trim($_), split

Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Brandon McCaig
On Fri, Sep 16, 2011 at 11:32 AM, Brandon McCaig wrote: >    my @column_headers = map { $_ = trim($_); $_; } >            split /\|/, $header_line; Sorry, that should be: my @column_headers = map trim($_), split /\|/, $header_line; I'm still relatively new to using BLOCKs within statements li

Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Shlomi Fish
Hi Brandon, On Fri, 16 Sep 2011 11:32:16 -0400 Brandon McCaig wrote: > On Thu, Sep 15, 2011 at 3:48 PM, Rob wrote: > > I have a file of test results it is formatted as follows: > > > >        School |fname| lname | sub| testnum|score| grade|level > > MLK School | John | Smith | RE | Test 1| 95|

Re: Files and Arrays - Search for values and write to the right

2011-09-16 Thread Brandon McCaig
On Thu, Sep 15, 2011 at 3:48 PM, Rob wrote: > I have a file of test results it is formatted as follows: > >        School |fname| lname | sub| testnum|score| grade|level > MLK School | John | Smith | RE | Test 1| 95| A | Prof > MLK School | John | Smith | RE | Test 2| 97| A | Prof > MLK School | J