in reply to removing Extra lines issues in arrays

How nice that it got resolved. Now would you please share your solution, and question, with us?

  • Comment on Re: removing Extra lines issues in arrays

Replies are listed 'Best First'.
Re^2: removing Extra lines issues in arrays
by rajeshatbuzz (Novice) on Jan 11, 2012 at 12:53 UTC
    Hi All, Sorry, guess my question was not updated but reply.. The problem is:
    my @list = qx(p4 -p $P4PORT groups); foreach my $group ( @list ) { ---------- ---------
    in this $group is returning correct value but with extra blank line. The issues is still there but trying to find a solution.

      Perhaps something like...

      my @list = grep { length } map { chomp } qx(p4 -p $P4PORT groups);

      The map {chomp} part applies chomp to each item in the list (which strips trailing line break characters).

      The grep {length} part then filters out any zero-length strings.