Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4331028
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:02:54+00:00 2026-05-21T10:02:54+00:00

I have a perl script that receives 3 arugments. First argument is very long

  • 0

I have a perl script that receives 3 arugments.

First argument is very long and contains spaces and quotes and I actually don’t know what size to expect it could be any size . To separate my arguments I use “:” sign.

See example:
./my_script.pl 2MT5 4XAW KEAR TTRR YYMM “TEMP 2012 FEB 01”:Single:123.x

The problem is that I lose double quotes and spaces.See output :

LOG The 1st input is:2MT54XAWKEARTTRRYYMMTEMP 2012 FEB 01

LOG Type is:Single

LOG Version is:123.x

My Code :

open (FD, ">file2.txt");

print FD @ARGV;

close FD;

my $str1=`cat file2.txt`;

my @argv_values = split(':',$str1);

$new_str = $argv_values[0];

$type = $argv_values[1];

$ver = $argv_values[2];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:02:55+00:00Added an answer on May 21, 2026 at 10:02 am

    Your Perl program does NOT receive 3 arguments, it receives 6 arguments. Simply print them out to see for yourself:

    perl -le 'print for @ARGV' 2MT5 4XAW KEAR TTRR YYMM "TEMP 2012 FEB 01":Single:123.x
    

    Your first argument (2MT5) is not “very long” it is only 4 characters.

    You do not have a Perl problem, you have a shell problem. The shell splits args on spaces and processes double quotes. If you don’t want it to do that, then you must quote any args that contain spaces or quotes:

    ./my_script.pl '2MT5 4XAW KEAR TTRR YYMM "TEMP 2012 FEB 01":Single:123.x'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Perl script that I'm attempting to set up using Perl Threads
I have a Perl script that sets up variables near the top for directories
I have a Perl script that I'd like to run on Windows, using either
I have a Perl script that pops up a message box when its work
I have an existing Perl script that uses the FTP object to send a
I have a little Perl script (On Windows) that checks some files for me
I have a Perl script where I maintain a very simple cache using a
I have written a Perl script that runs as a daily crontab job that
I have configured Tomcat 6 to serve Perl CGI scripts. That part is well
I have Perl script and need to determine the full path and filename of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.