#!/usr/bin/env perl # Spurious Signal Requirements up to 225 Mhz sub Print { printf "\n\n-----\n\n Required attenuation of spurious signals:\n\n". " %.3f dB for %s watts at %s MHz\n\n". " Remember, airwaves belong to the public. Use them.\n\n",$db,$pwr,$frq; } print "\n\n\t\tSpurious Signal Requirements Up To 225 Mhz\n\n"; while (!$frq || $frq > 225 || $frq =~ m/[a-z]/i) { print "Enter frequency (in MHz): "; chomp($frq = ); $frq =~ tr/0-9.//csd; } print "\n"; while (!$pwr) { print "Enter transmitter power (in watts): "; chomp($pwr = ); $pwr =~ tr/0-9.//csd; } if ($frq < 30) { if ($pwr < 5) { &Print($db = 30); } elsif ($pwr >= 5 && $pwr <= 500) { &Print($db = 40); } elsif ($pwr > 500) { &Print($db = (((log $pwr) / (log 10)) * 10) + 13); } } elsif ($frq >= 30 && $frq <= 225) { if ($pwr < 0.1) { &Print($db = (((log $pwr) / (log 10)) * 10) + 50); } elsif ($pwr >= 0.1 && $pwr <= 0.25) { &Print($db = 40); } elsif ($pwr > 0.25 && $pwr <= 25) { &Print($db = (((log $pwr) / (log 10)) * 10) + 46); } elsif ($pwr > 25) { &Print($db = 60); } }