Not really what you wanted, eh? But, I recommend it because you really want to write:
because print sends stuff to the person using your script, not to the person writing your script. The person using your script shouldn't need to know what names you gave to your variables.isInRange( $cntFiles, 'Number of Files', $minFiles, $maxFiles );
Something more like what you want would be:
but that doesn't work with lexical variables (which are the types of variables you should use 95% of the time) and doesn't work under use strict (which is what you want to use 95% of the time). So "just say 'no'".isInRange( *test_me, $min, $max ); sub isInRange { my( $glob, $min, $max )= @_; my $val= $$glob; my $name= substr($glob,1); if( $val < $min ) { die "\$$name is less than $min.\n" } elsif( $max < $val ) { die "\$$name is more than $max.\n" } else { return 1; } return !1; }
Then there is the C preprocessor option... Actually, it isn't really much of an option. Nevermind. Trust me; you don't even want to know.
- tye (but my friends call me "Tye")In reply to (tye)Re: Can Perl add single quotes?
by tye
in thread Can Perl add single quotes?
by tenya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |