Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: The error says the value is uninitialized, but it works anyway

by karlgoethebier (Monsignor)
on Aug 19, 2019 at 18:44 UTC ( #11104698=note: print w/replies, xml ) Need Help??


in reply to The error says the value is uninitialized, but it works anyway

A different solution AKA TMTOWTDI using Set::Scalar:

#!/usr/bin/env perl use strict; use warnings; use Test::More; use Data::Dump; use Set::Scalar; my @colors = qw(red green blue yellow pink purple brown); my @drop = qw(pink brown); my @expected = qw(red green blue yellow purple); my $colors = Set::Scalar->new(@colors); print qq(\@colors = ); dd @colors; print qq(\@drop = ); dd @drop; print qq(\@expected = ); dd @expected; $colors->delete(@drop); my @result = $colors->members; print qq(\@result = ); dd @result; is(@result, @expected, qq(Dropping members @drop from \@colors)); done_testing(); print qq(\@colors = ); dd @colors; __END__ Karls-Mac-mini:Desktop karl$ ./mizducky_02.pl @colors = ("red", "green", "blue", "yellow", "pink", "purple", "brown" +) @drop = ("pink", "brown") @expected = ("red", "green", "blue", "yellow", "purple") @result = ("purple", "red", "yellow", "green", "blue") ok 1 - Dropping members pink brown from @colors 1..1 @colors = ("red", "green", "blue", "yellow", "pink", "purple", "brown" +)

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11104698]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2019-11-19 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (96 votes). Check out past polls.

    Notices?