By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

Parsing escape characters in @ARGV

P: 1

This is my first post to this forum, because until now Perl has been one of the most convenient and intuitive programming languages I know. However, now I have an issue that I cannot resolve. I want to pass a string as a command line argument, and (for the purposes of this question) print the string. This works fine, except for the fact that escape characters are not parsed.

The code:
Expand|Select|Wrap|Line Numbers
  1. $output1 = $ARGV[0];
  2. $output2 = "line 1\nline 2";
  4. print $output1;
  5. print "\n";
  6. print $output2;
The call:
Expand|Select|Wrap|Line Numbers
  1. perl "line 1\nline 2"
The output:
Expand|Select|Wrap|Line Numbers
  1. line 1\nline 2
  2. line 1
  3. line 2
I'm running Perl 5.10.0 on the Command Prompt of WinXP.

Does anyone know how to parse the escape characters in @ARGV? Thanks in advance.
Nov 13 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.