Weide wrote:
Can anyone tell me why the map will not map out the unitialized
variable in this code with 'str'? Thanks a lot,
use strict;
use warnings;
sub total
{
my $firstone = shift;
my $sum = 0;
my $item = 0;
map { defined $_ ? $_ : 'str' } @_ ;
print @_;
}
my $hello;
Rob Dixon wrote:
Weide wrote:
Can anyone tell me why the map will not map out the unitialized
variable in this code with 'str'? Thanks a lot,
use strict;
use warnings;
sub total
{
my $firstone = shift;
my $sum = 0;
my $item = 0;
map { defined $_ ? $_ : 'str' } @_ ;
print
Weide wrote:
>
> Can anyone tell me why the map will not map out the unitialized
> variable in this code with 'str'? Thanks a lot,
>
>
> use strict;
> use warnings;
>
> sub total
> {
> my $firstone = shift;
> my $sum = 0;
> my $item = 0;
> map { defined $_ ? $_ : 'str' } @_ ;
>
Weide wrote:
Can anyone tell me why the map will not map out the unitialized
variable in this code with 'str'?
It does.
map { defined $_ ? $_ : 'str' } @_ ;
print @_;
You probably meant to write
print map { defined $_ ? $_ : 'str' } @_ ;
--
Gunnar Hjalmarsson
Email: http://w
Can anyone tell me why the map will not map out the unitialized
variable in this code with 'str'? Thanks a lot,
use strict;
use warnings;
sub total
{
my $firstone = shift;
my $sum = 0;
my $item = 0;
map { defined $_ ? $_ : 'str' } @_ ;
print @_;
}
my $hello;
print "not def