473,698 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ARGV doesn't work on Windows 2008?

dlite922
1,584 Recognized Expert Top Contributor
A script stopped working when I moved it from Win 2003 server to Win 2008. After some troubleshooting it seems that it was not grabbing the command line parameters.

So I did a print $ARGV and exit at the beginning of the file and I get this:

Expand|Select|Wrap|Line Numbers
  1. Use of uninitialized value $ARGV at .... line X
  2.  
I'm using perl from a folder, not installed or in window's path.

Thanks!


Dan
Oct 12 '10 #1
10 3697
RonB
589 Recognized Expert Moderator Contributor
$ARGV is a scalar variable. What you're wanting is @ARGV which is an array.

I you want to post your script and how you're executing it, we should be able to find the problem.
Oct 12 '10 #2
dlite922
1,584 Recognized Expert Top Contributor
Sorry, that's a PHP->Perl mistake.

There isn't any script, just this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. print "Testing ARGV...\n"; 
  3. print @ARGV;
  4. print #$ARGV;
  5.  
  6.  
It prints an empty line after that message of course.
Oct 13 '10 #3
RonB
589 Recognized Expert Moderator Contributor
Syntax error, change:
Expand|Select|Wrap|Line Numbers
  1. print #$ARGV;
to:
Expand|Select|Wrap|Line Numbers
  1. print $#ARGV;
Or a better method to see what's in the array.
Expand|Select|Wrap|Line Numbers
  1. use Data::Dumper;
  2. print Dumper \@ARGV;
Oct 13 '10 #4
dlite922
1,584 Recognized Expert Top Contributor
yes, that was a typo, I apologize. It remains the same though, still doesn't work.

Whatever it takes to convince you :)

here's my file now:

Expand|Select|Wrap|Line Numbers
  1. use Data::Dumper;
  2. print Dumper \@ARGV;
  3.  
Here's the output on Win 2k8:
Expand|Select|Wrap|Line Numbers
  1. C:\>test.pl test test test
  2. $VAR1 = [];
  3.  
Weird huh? Code works fine on my XP PC.

Output On XP:
Expand|Select|Wrap|Line Numbers
  1.  
  2. C:\tmp>test.pl test test test
  3. $VAR1 = [
  4.           'test',
  5.           'test',
  6.           'test'
  7.         ];
  8.  
  9.  
  10.  
I'm out of ideas. Googled with no avail.


Dan
Oct 13 '10 #5
RonB
589 Recognized Expert Moderator Contributor
Your file type association is not setup correctly.

Run a test by executing your script like this:
C:\>perl test.pl test test test
Oct 13 '10 #6
numberwhun
3,509 Recognized Expert Moderator Specialist
This is most puzzling because I have worked on both windows platforms you mentioned, doing Perl development of course, and never experienced this issue. I am anxious to see what happens with Ron's last suggestion.
Oct 13 '10 #7
RonB
589 Recognized Expert Moderator Contributor
It's been my experience that this is a common problem when the OP has never installed perl and is using a port which makes you set these types of settings without a supplying any defaults.

The action attribute of the open setting within the file type association should be set to something like this:
"C:\Perl64\bin\ perl.exe" "%1" %*
The key part being:
"%1" %*
which sets/allows for the acceptance of the script arguments aka @ARGV. Calling the perl interpreter directly and passing it the script and args will "get around" the problem, but is not the best/proper solution.
Oct 14 '10 #8
numberwhun
3,509 Recognized Expert Moderator Specialist
Agreed! Lets see what happens when they run it.
Oct 14 '10 #9
dlite922
1,584 Recognized Expert Top Contributor
Ron was exactly right.

I half-heatedly explained that perl is not installed, but since it "worked" I didn't have any technical reasons why ARGV wouldn't work.

It does have to do with file association, because like he said when I gave my file to perl.exe it worked!

Expand|Select|Wrap|Line Numbers
  1.  
  2. C:\temp\Perl64\bin>perl.exe C:\test.pl test test test
  3. $VAR1 = [
  4.           'test',
  5.           'test',
  6.           'test'
  7.         ];
  8.  
  9.  
Awesome! Thank you.

Why not installed? This is a loaned/borrowed server and want to return it in the same exact shape I got it. (Running everything from inside a folder makes for easy cleanup later)

Thanks guys,


Dan
Oct 14 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2382
by: jerry | last post by:
I'm trying to run an application under another user within a winform app writen in C#. I have tried a number of different things, but it seems that the CreateProcessWithLogonW function should work to do what I need to do. This appears to work just fine in Windows 2000 and XP with service pack 1, but it doesn't work with XP service pack 2 installed. I'm sure it's one of the "Enhanced security features" of service pack 2, but I can't...
4
1859
by: PengYu.UT | last post by:
The following shows the source code and the error message(from g++-3.3). I wrote two assignment operator. One is for the same type case, the other one is for different type case. I'm wondering why it doesn't work. The error line is marked with comments in the source code. Thanks, Peng
10
1830
by: Sourcerer | last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and tried to run it on my friend's computer (he doesn't have the compiler). We both have Windows XP Professional. I have .NET framework 2.0, and he had 1.0 and it didn't work; then he installed 2.0 and it still didn't work; so he tried with 2.1 and it didn't work, then 3.0 and nothing still worked. I have Intel Centrino Mobile (laptop computer), and he has Intel Pentium...
7
12993
by: Sin Jeong-hun | last post by:
Hi. I need to simulate keyboard and mouse events. For the first step, I tried to move mouse using SendInput. But it didn't work. I searched all over the internet for an example, but only questions were there. Please give me what was wrong in the following code. I simplified the code so that you can just copy it to a console app project, and run it. Thank you for any help. PS: I need to work with SendInput the way it is, not SendMessage...
0
1324
by: silkodyssey | last post by:
I recently installed the release version of visual c#2008 and I decided to test it with a wpf application. I tried dragging controls to the form but it doesn't work, the controls do not appear on the form. I tried reinstalling c# and the .net framework but it doesn't have any effect on the problem. I decided recently to install vb 2008 to see if it has the same problem but it doesn't, dragging controls to the form works fine. Does anyone...
3
1529
by: cosmos22 | last post by:
The loop below doesn't work, I was wondering if anyone can help me. I need to create an infinate loop around the while condition. The error states that 'd' is undeclared Thank you all :) #include "windows.h" #include "winioctl.h" #include <string> #include <iostream>
4
5807
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this article: http://support.microsoft.com/?id=306158#4 This doesn't work in Windows 2008 Server, we receive the following exception:
1
3834
by: Andy B | last post by:
I have the following code and can't quite figure out why it doesn't work. in the first section, I am trying to take the data from a entity framework function import and use it inside a repeater. <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <% #Bind("Title") %> </ItemTemplate> </asp:Repeater>
3
689
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
Note: My apologies for repeating this post from last week, but my nospam alias and profile account were incorrect. I think I have fixed this, so hopefully this post will trigger MS into a response per their MSDN policy. -------------------- I have a web site under .NET 2.0 that renders videos using the Silverlight media player. The web page looks like this: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="video2.aspx.cs"
4
2835
by: BuildHome | last post by:
Hello, I have windows 2008 R2 and IIS 7.5 with PHP 5.2.4. I've tried to upgrade to PHP 5.3.3 and the same problem. I'm using WORDPRESS or phpmyadmin that need to use session. I've enabled and gave the folder write permissions. When I'm trying to use the session its created but its forgotten...
0
8668
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9014
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.