+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 6
    Points: 1,415, Level: 8

    Join Date
    Aug 2005
    Location
    Mumbai,India
    Posts
    13
    Helped
    0 / 0
    Points
    1,415
    Level
    8

    perl passing single input argument

    I have written a small code in Perl to search for a given string in text files in a given directory. I take the directory name and string as input arguments to the perl program. Perl takes the space as the seperator for the argument, this does not allow for spaces in the directory name/ text string.
    Is there a way by which a single input argument can have a space?

    •   AltAdvertisement

        
       

  2. #2
    Newbie level 6
    Points: 1,415, Level: 8

    Join Date
    Aug 2005
    Location
    Mumbai,India
    Posts
    13
    Helped
    0 / 0
    Points
    1,415
    Level
    8

    perl input argument

    Is there a way to have spaces in ARGV[0], ARGV[1] etc in Perl ?
    eg if I type perl -w search.pl a1 a2, then the arguments are seperated by space, I have an argument which has a space, How do I deal with it?

    Still waiting for an answer ...

    Thanks in advance



    •   AltAdvertisement

        
       

  3. #3
    Full Member level 2
    Points: 2,926, Level: 12
    umairsiddiqui's Avatar
    Join Date
    Apr 2004
    Location
    Sweden
    Posts
    144
    Helped
    7 / 7
    Points
    2,926
    Level
    12

    perl input a directory name with spaces

    windows:
    inclose the args with spaces with "" (double quotes), example
    Code:
    program "arg 0" "arg 1"
    unix:
    inclose the args with spaces with '' (single quotes), example
    Code:
    > program 'arg 0' 'arg 1'



--[[ ]]--