
ryantkoehler
Novice
Feb 28, 2012, 1:19 PM
Post #1 of 5
(1714 views)
|
|
command line slice argument
|
Can't Post
|
|
Hi I would like to accept a slice argument (string) from the command line that then may be used to select a subset of columns from an input file. Doing this directly apparently does not work (error is that argument (to slice) is not numeric). Here are some more details. I use GetOptions to accept a command line string such as 1..5,10..15 (i.e. $col_slice = "1..5,10..15). Next, once I've got a list of items (e.g. words on a line), I would like to simply get the subset (if specified): if ( $col_slice ) { @words = $words[$col_slice]; } I'm sure this is "easy" if you know the trick. I don't know the trick. Thanks in advance for any help. -Ryan
|