in reply to Re: Re: Re: No other way?
in thread No other way?
So, /^$/ actually classifies a single newline as an "empty" string.... Sometimes thats what you want, but it isn't usually what people expect.#!/usr/bin/perl -wT use strict; # only one one of these is an "empty" string right? my @arr = ("", "\n", "dog", "cat"); my @haslength = grep {length} @arr; my @notempty = grep {!/^$/} @arr; print scalar @haslength, " members have length\n"; print scalar @notempty, " members are not \"empty\"\n"; __END__ =head1 OUTPUT 3 members have length 2 members are not "empty"
-Blake
|
|---|