how to include slashes "/" in @ARGV (Perl)

Hello
I have simple script that will accept as arg string like this :

".../foo/blah/,.../.../foo1/,.../blah"

now perl automatically removes the slashes "/" , I can't escape the slashes in the input I have to control on it
so how can I force perl to not touch this slashes?

Thanks
allot

I haven't heard about Perl removing slashes from anything passed into @ARGV.

In particular, I performed this test (on a Windows machine right now, but I guess this is true for *nix as well):

D:\Documents and Settings\bernardchan>perl -e "print $ARGV[0]" "a/b/c/d"
a/b/c/d

Maybe the shell or some other intermediate programs are the culprit?

Hello i ahev this simple simple script that gets input and print input :
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/usr/bin/perl

$libs = @ARGV[0];
print "\n$libs \n";
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

im excutinng the script as this :

myscript.pl ..\blah,..\..\..\blahq,..\..\..\..\..\blah\blah\blah,..\..\..\..\..\blah11\bo,..\..\..\..\..\Libraries\Include\foo,..\..\..\..\..\foo\foo1\fo2\fo3,

and the print output is :

..blah,......blahq,..........blah\blah\blah,..........blah11bo,..........LibrariesIncludefoo,..........foofoo1fo2fo3,

as you see all the slashes are gone
how can i avoid this ?

thanks

I knew what you meant. As I said, obviously it is the shell, not Perl, that is eating the backslashes.

cbkihong@cbkihong:~$ perl -e 'print $ARGV[0] . "\n"' '..\b\v\d'
..\b\v\d
cbkihong@cbkihong:~$ perl -e 'print $ARGV[0] . "\n"' ..\b\v\d
..bvd
cbkihong@cbkihong:~$ perl -e 'print $ARGV[0] . "\n"' ..\\b\\v\\d
..\b\v\d

If you feel more comfortable looking at your own example:

Even though you said you cannot control the controlling process, but actually it is that process that has made an incorrect assumption that parameters need not be quoted, but the fact is special characters are treated specially by the shell.

For instance, the bash manpage has this:

So you have no option but to teach the process that generates the command to quote the parameters or escape the offending characters (\ $ etc.), because the backslashes have already been gone by the time they reach Perl. Perl has no way of getting them back!

I want to execute a perl program that has an argument like this:
sys_db2actp_runstats_AUTOSYS.pl "/db2qdir1/scripts/db2" db2actq EMLNK_DB
in UNIX. It doesn't accept the /db2qdir1/scripts/db2 argument. I have tried enclosing with double quotes, single quotes, tick marks "`", and no quotes. What am I doing wrong ?

You're posting a new question onto the end of a 3 year old thread. :cool: