in reply to Re: removing Extra lines issues in arrays
in thread removing Extra lines issues in arrays

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.

Replies are listed 'Best First'.
Re^3: removing Extra lines issues in arrays
by tobyink (Canon) on Jan 11, 2012 at 14:14 UTC

    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.