#!/path/to/perl use strict; if ($#ARGV != 2) { die "Usage: progname \n"; } my $txp = $ARGV[0]; my $wxp = $ARGV[1]; $txp =~ tr/0-9//cd; $wxp =~ tr/0-9//cd; if ((length($txp) < 1) || (length($wxp) <1) || ($wxp == 0) || ($wxp == $txp)) { die "Unable to compute value!\n"; } my $snr = 8.68589 * (log($wxp/($txp-$wxp))); print "Signal-to-Noise ratio is $snr dB\n"; exit 0;