Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/opt/local/bin/perl
- use 5.12.0;
- use warnings;
- my %hash_1 = ( a => 'qw', b => 'dd', c => 'ddd', d => '322', e => 'fj');
- my %hash_2 = (q => '23', w => '2234', r => 'djh', t => 'ddsd', y => 'sddssd') ;
- {
- my %hash_int; # HA-HA no one can`t touch it!
- sub limit_each {
- my ($step) = @_;
- say '+open loop';
- while ( $step-- && (my ($key, $val) = each %hash_int )){
- say $key,"\t",'--->',$val;
- }
- say '-exit loop';
- }
- sub set_hash{
- %hash_int = @_;
- say 'new hash!';
- while ((my ($key, $val) = each %hash_int )){
- say $key,"\t",'--->',$val;
- }
- }
- }
- # first hash
- set_hash(%hash_1);
- limit_each(3);
- limit_each(2);
- set_hash(%hash_2);
- limit_each(2);
- limit_each(3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement