Re: @ARGV being corrupted
by gellyfish (Monsignor) on Jul 22, 2004 at 14:10 UTC
|
The smallest snippet of code that demonstrates the behaviour that you are talking about would be useful.
/J\
| [reply] |
|
|
if ( $ARGV[$i] eq "devl" ) {
print "$ARGV[$i]\n";
}
Thats all the code is. i can actually transplate the specific code and run it seperate and it works fine so what my question is what possibly could have changed in a library, etc that would cause this? maybe a conflict between versions?
Edit by castaway - added code tags | [reply] [d/l] |
|
|
| [reply] [d/l] |
|
|
brackets should be around $i
| [reply] |
|
|
Re: @ARGV being corrupted
by dragonchild (Archbishop) on Jul 22, 2004 at 14:24 UTC
|
Also, specifying the Perl version and the OS you're running on would be very helpful.
Plus, is there a reason why you're not using Getopt::Std or Getopt::Long to parse command-line arguments? This is a solved problem, with solutions that are part of the mainline Perl distribution ...
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
| [reply] |
|
|
This method of option processing has been historic. Full reasons as to why not sure. The version we are using is 5.6.1
| [reply] |
Re: @ARGV being corrupted
by roju (Friar) on Jul 22, 2004 at 14:25 UTC
|
If you use one of the Getopt modules, say Getopt::Std, does it work then? It could be a problem with your argument handling code.In place of your current argument grokking code, try:
use Getopt::Std;
my %args;
getopts ('V:', \%args);
print $args{'V'};
Do you get the expected results? | [reply] [d/l] |
Re: @ARGV being corrupted
by husker (Chaplain) on Jul 22, 2004 at 14:33 UTC
|
If it hurts when you do that, don't do that. Instead, as the other Wise Ones have said, look at Getopt::Std. There's no excuse to re-invent that wheel, not even "that's the way we've always done it!" :) | [reply] |
|
|
This fails on both Solaris ( not sure the version at this time ) and Windows 2000 . Using Perl version 5.6.1 .
The line of code did detect the option but my previous detect for -V does that too, I will look and see how I can gather the "devl" specification.
| [reply] |
|
|
Found the problem.
Since this is utilized across platforms someone must have modified it on windows. had the ^M characters on the ending lines. removed them and it worked.
| [reply] |
|
|