Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl Bug handling arguments passed to a script #814

Closed
p5pRT opened this issue Nov 4, 1999 · 2 comments
Closed

Perl Bug handling arguments passed to a script #814

p5pRT opened this issue Nov 4, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 4, 1999

Migrated from rt.perl.org#1742 (status was 'resolved')

Searchable as RT1742$

@p5pRT
Copy link
Author

p5pRT commented Nov 4, 1999

@p5pRT
Copy link
Author

p5pRT commented Nov 4, 1999

From @tamias

On Thu, Nov 04, 1999 at 09​:43​:28AM -0500, John Amelia wrote​:

When executing a perl script arguments such as perl_script file arg1 arg2 arg3
generate error messages.

  Can't open arg1​: A file or directory in the path name does not exist\.
  Can't open arg2​: A file or directory in the path name does not exist\.
  Can't open arg3​: A file or directory in the path name does not exist\.

Here is a copy of the script ---

  NV6KNCC cat do\_rshell\.pl
  \#\! /usr/local/bin/perl

  $rcmd = @​ARGV\[0\];

  while\(\<>\) \{
        chomp;
        $R = $\_;
        @&#8203;cmd = \("/u/t01bhjt/do\_router\_rshell"\, $R\, $rcmd\);
        system\(@&#8203;cmd\);
  \}

And what did you expect to get when you tried to open files that don't
exist?

The input operator <>, when used without an explicit filehandle, opens the
files named in @​ARGV in turn. Each element in @​ARGV is treated as a
filename. This is documented in perlop.

It appears that you need correct your script so that it does not treat the
extra arguments as filenames.

Ronald

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant