Re: Command line usage



On Jun 18, 10:50 am, jeehan...@xxxxxxxxx (John Degen) wrote:

I think I'm out of luck with this OS;) Your suggestion for creating a backup
file gave the same result: no error, no change in the files. The output of
'perl -le"print for @ARGV" *' is * and the other is *.*. Funny though that
sed *does* work.

Ah. Well there's your problem. The command line interpreter you're
running doesn't expand wildcards. That's why Perl wasn't giving you
any errors - it had nothing to do because there was no file named "*"
that it could find... You'll have to expand the wildcard from within
Perl.

perl -pi.bkp -e"BEGIN { @ARGV = glob($ARGV[0]); } s/old/new/;" *

Hope this helps,
Paul Lalli

.



Relevant Pages

  • Re: !# script interpreter convention ...
    ... >test.pl: Command not found. ... >I am using tcsh shell, ... >whereas running 'perl test.pl' is woking. ... >first line of a script will lead the shell to run command 'interpreter ...
    (comp.unix.shell)
  • Re: Execute Windows program from Perl script (??)
    ... >> This is not a question about Perl, it is a question about the host ... >> operating system's command line interpreter ... > best I get is a hung browser and a copy of cmd.exe in task mangler for ...
    (comp.lang.perl.misc)
  • Re: Need help for basic use of perlembed
    ... > and I'd like to do as this command line: ... they're interpreted by the shell. ... To achieve something similar with an embedded Perl, ... constructing a Perl interpreter and running your Perl code. ...
    (comp.lang.perl.misc)
  • Re: Call another program using system
    ... Your command line program is a separete entity from your PERL program. ... by your command line interpreter and not PERL. ... PERL does have a shell module that exposes some of the ...
    (comp.lang.perl.misc)
  • Re: Command line usage [solved]
    ... running doesn't expand wildcards. ... That's why Perl wasn't giving you ... You'll have to expand the wildcard from within ... The command works, creates a neat backup file and does what it's told. ...
    (perl.beginners)