in reply to Re: diamond operator multiple input
in thread diamond operator multiple input

Doing map { chomp; lc } <>; generates a "Useless use of lc in void context ..." error, lc $_ seems to solve that. You could avoid reading the whole file by explicitly doing a scalar <> twice.

$ cat zzzz AAAA BBBB CCCC DDDD EEEE $ perl -e ' > ( $dg, $vo ) = map { map { chomp; lc $_ } scalar <> } 1 .. 2; > print qq{$dg, $vo\n}; > print q{-} x 15, qq{\n}; > print for <>;' zzzz aaaa, bbbb --------------- CCCC DDDD EEEE $

I hope this is of interest.

Cheers,

JohnGG

Update: As ikegami points out, the warning I saw seems to be a figment of my imagination. Please ignore that part of the post.

Replies are listed 'Best First'.
Re^3: diamond operator multiple input
by ikegami (Patriarch) on Jan 22, 2009 at 14:17 UTC
    I cancan't replicate your warning.
    >perl -we"my ($dginput, $volinput) = map { chomp; lc } <>;" a b c ^Z

    Not even if I remove the assignment.

    >perl -we"map { chomp; lc } <>;" a b c ^Z

    Tested with 5.6, 5.8 and 5.10

      Neither can I now and the window I was working in is long since closed so I can't see what I did to generate it :-(

      As you say, this

      $ perl -we ' > ( $dg, $vo ) = map { map { chomp; lc } scalar <> } 1 .. 2; > print qq{$dg, $vo\n}; > print q{-} x 15, qq{\n}; > print for <>;' zzzz aaaa, bbbb --------------- CCCC DDDD EEEE $

      works without any warnings. I will update my original node.

      Cheers,

      JohnGG