Quick actions

cmd+k|ctrl+k

Navigation

Languages

count linked nodes

Snippet info

Language

Perl

Visibility

public

Author

grtodd

Created

2017-03-13T13:17:12Z

Updated

2017-03-14T15:02:10Z

#use CSV_PP 'csv';
#my $data =  *STDIN; # or *DATA to pull out of __DATA__
#my $employees = csv ({ in => $data, key => "posnum"});
my $employees = { map {chomp; split ',',$_ } <> } ;
my $levels = 0 ;
my $violation = qq{
\tPlease see Section 5.1 of the Directive.} ;

for (keys %$employees) {
    do {
        print "$_ ";
        #$_ =  $employees->{$_}{"supposnum"};
        $_ =  $employees->{$_};
        $levels++;
    } while defined ;
    $levels--;
    print "\n\tYou have $levels reporting layers." ;
    print $violation if $levels > 3 ;
    print " \n" ;
    $levels = 0 ;
}

__DATA__
posnum,supposnum
123487,999007
123488,999007
123500,999007
123499,999007
123497,999007
999007,988007
988007,999666
999666,1000000
INFO