SPUG:command line switches: the DWIMmyness that is Perl
SPUG-list-owner
tim at consultix-inc.com
Mon Jan 20 11:12:52 CST 2003
On Sun, Jan 19, 2003 at 11:59:24PM -0800, Fred Morris wrote:
> Hi all,
>
> I use Perl for all sorts of complicated things, but I confess to never
> having played with the command line switches until tonight. I wanted
> something which would expand tabs into spaces, but I wanted to be able to
> specify the tab stop: sometimes it's 4, sometimes it's 8... anybody else
> find themselves in the same predicament?
>
> Fred Morris
> m3047 at inwa.net
There's a much easier way to handle switches, suitable for whipping things
up really quickly.
Just use the -s invocation option, and then the user can do -tabstop=5
as a command-line argument to set the variable $tabstop to 5 within the
script, or simply -tabstop to set the same variable to a true value.
See perldoc perlrun for details.
-Tim
*-----------------------------------------------------------*
| Tim Maher, CONSULTIX (206) 781-UNIX (866) DOC-PERL |
| CEO, JAWCAR ("Just Another White Camel Award Recipient") |
| tim at consultix-inc.com teachmeunix.com teachmeperl.com |
*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*
| CLASSES: Basic Perl: 2/10-12 Perl Modules: 2/13-14 |
*-----------------------------------------------------------*
More information about the spug-list
mailing list