M
Mr P
Sounds just like keys %h don't it.
Starting with
$_ =
"cat
man
dog
mouse
man
man
";
I want to end up with
[cat man dog mouse]
My approach is:
my @s = split /\n/;
# unique-afy it!
my %s;
@s{@s} = @s;
@s = keys %s;
My PREFERENCE is to not have to involve both a hash and an array, and
also to not have to include a non-native lib module.
Is there a syntax I can use to just work with the hash and populate
the keys-only directly from the split? I don't really care what the
values are. I don't even care if they are undef.
Thank-You, Peristas,
MP
Starting with
$_ =
"cat
man
dog
mouse
man
man
";
I want to end up with
[cat man dog mouse]
My approach is:
my @s = split /\n/;
# unique-afy it!
my %s;
@s{@s} = @s;
@s = keys %s;
My PREFERENCE is to not have to involve both a hash and an array, and
also to not have to include a non-native lib module.
Is there a syntax I can use to just work with the hash and populate
the keys-only directly from the split? I don't really care what the
values are. I don't even care if they are undef.
Thank-You, Peristas,
MP