Hi Brandon, Igor, Shawn Thank you very much for your replies. Appreciate your time and help. I later realized that the error was creeping not due to the - or any other character in the string, but a ' character that was introduced at the end of the line by mistake.
The horror was that the perl compiler pointed at a code some 1000s of lines below this line for the error which was completely confusing. Now I learnt how small mistakes can take hours to resolve and will be careful in future. Thanks, Regards, Satya P.S : unfortunately, I cant provide more details due to the IP restrictions, sorry about that, hope you understand, otherwise would have posted the code in the first go. -----Original Message----- From: Brandon McCaig [mailto:[email protected]] Sent: 29 November 2011 15:15 To: Nemana, Satya Cc: [email protected] Subject: Re: passing arguments to perl function with - in the string On Tue, Nov 29, 2011 at 08:12:29AM -0500, Nemana, Satya wrote: > Hi Hello: > I need to pass argument to a function like this -chan_range => > "$chs-$che" > > Normally when this used which works -chan_range => "1-24" > > However, when I try to put variable values instead of a scalar string, I > get compilation errors (the errors are in different part of the code > which is completely clueless) There's nothing special about interpolating a string with a '-' character in it. That should work fine. Tell us the actual errors that you are getting and we can help you to understand them. > I tried using \" and without the " also, but nothing helped. You seem to be struggling with Perl syntax at a basic level. Perhaps you would benefit from reviewing perlsyn and/or perldata. perldoc perlsyn perldoc perldata (Or look them up online) Regards, -- Brandon McCaig <[email protected]> <[email protected]> Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
