in reply to finding the varaible quantity and static quantity from comma separated data and values

Store the registers as keys in a hash of hashes, use the values as the inner keys. After the file has been processed, iterate over the registers and count how many keys the inner hashes have. Those with a single key are the constant registers.
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my %R; while (<<>>) { chomp; my ($register, $value) = split /,\s*/; ++$R{$register}{$value} } for my $register (keys %R) { say $register, "\t", keys %{ $R{$register} } > 1 ? 'variable' : 'constant'; }
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
  • Comment on Re: finding the varaible quantity and static quantity from comma separated data and values
  • Select or Download Code