Home > Syntax Error > Perl Syntax Error Near Unexpected Token

Perl Syntax Error Near Unexpected Token


Any ideas? If you'd like to contribute content, let us know. The shell interprets the command you are typing, ( and ) are characters with a special meaning for the shell, so you MUST hide them by quoting or by escaping. asked 2 years ago viewed 1030 times active 2 years ago Related 0Rename files and directories with a special characters on solaris machines0can something besides the shebang set the interpreter?43Does the check my blog

tr command has no effect when used in $() and saved in a variable Why don't cameras offer more than 3 colour channels? (Or do they?) What kind of weapons could This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. Seekers of Perl Wisdom Cool Uses for Perl Meditations PerlMonks Discussion Categorized Q&A Tutorials Obfuscated Code Perl Poetry Perl News about Information? See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question. 4 Are

Perl System Syntax Error Near Unexpected Token ('

Not the answer you're looking for? I will list the code and the error message below. #!/usr/bin/perl -w $pi = 3.141592654; print "What is the radius? "; chomp($radius = ); $circ = 2 * $pi * $radius; Why did they bring C3PO to Jabba's palace and other dangerous missions? more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation

The string 'str'"in"'g' in the shell is equal to 'string' after quote removal; you can similarly use adjacent single-quoted and double-quoted strings to build your script ... Join our community today! Why don't cameras offer more than 3 colour channels? (Or do they?) Why do units (from physics) behave like numbers? It's used for optimization, not for excluding characters.

asked 3 years ago viewed 2287 times active 3 years ago Related 8syntax error near unexpected token `('0Syntax error near unexpected token `done'1syntax error near unexpected token `3syntax error near unexpected Sh: -c: Line 0: Syntax Error Near Unexpected Token `(' Perl You can actually leave them in if you want to, but you don't need to.] Note that there are some problems with your regex pattern. (?!\#)(loop_.+rev) is the same as (loop_.+rev) I'm not sure I can help very much here. http://stackoverflow.com/questions/15770014/syntax-error-near-unexpected-token-perl-code share|improve this answer answered Sep 12 '11 at 6:36 Jonathan Leffler 441k62512824 1 Thank you for you help the error ended up being a blank line before the shebang #!

Socks just get in the wayResults (302 votes). Why isn't tungsten used in supersonic aircraft? To find the number of X completed, when can I subtract two numbers and when do I have to count? By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features.

Sh: -c: Line 0: Syntax Error Near Unexpected Token `(' Perl

So my real question is would there be an easier solution using sed, egrep or awk? http://stackoverflow.com/questions/30762228/why-do-i-get-bash-syntax-error-near-unexpected-token-when-i-run-my-perl Main Menu LQ Calendar LQ Rules LQ Sitemap Site FAQ View New Posts View Latest Posts Zero Reply Threads LQ Wiki Most Wanted Jeremy's Blog Report LQ Bug Syndicate Latest Perl System Syntax Error Near Unexpected Token (' Is this alternate history plausible? (Hard Sci-Fi, Realistic History) Asking for a written form filled in ALL CAPS Movie about a board-game that asks the players touchy questions How much interest " Syntax Error Near Unexpected Token `('" Bash Where's the 0xBEEF?

archtoad6 View Public Profile View LQ Blog View Review Entries View HCL Entries View LQ Wiki Contributions Visit archtoad6's homepage! http://back2cloud.com/syntax-error/perl-while-loop-syntax-error.php Thanks! –user974873 Jan 13 '14 at 16:17 | show 1 more comment up vote 3 down vote It seems that the shebang line (#!/usr/bin/perl) isn't interpreted on your system because bash the error is just coming, i suppose, while giving the file name in double quotes. As I said, lame, but ... (sigh) EDIT: I just thought of a third way.

You can also try using: #!/usr/bin/env perl Instead of your current shebang to see if perl picks it up. A word to describe meaningless exchanges in conversation Generating Pythagorean triples below an upper bound Does "when ~ dies, deal n damage to all players/creatures" have a name? Grayscale not working in simple TikZ Why is AT&T's stock price declining, during the days that they announced the acquisition of Time Warner inc.? "Surprising" examples of Markov chains apt-get how news But the error boils down to this: You can use either single or double quotes around an argument in the shell (bash, in this case), and either type can quote the

linux solaris perl shebang share|improve this question edited Jan 14 '14 at 2:44 Patrick 34.5k681130 asked Jan 13 '14 at 15:37 user974873 33 closed as unclear what you're asking by slm♦, more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Select Only Printed Out Cells Are illegal immigrants more likely to commit crimes?

Are there any historically significant examples?

Why can't I set NODE_ENV to undefined? If so, does any one know where to begin? bigearsbilly View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by bigearsbilly 06-21-2007, 02:12 AM #4 kambrish LQ Newbie Registered: Jun 2007 Location: LinuxQuestions.org > Forums > Non-*NIX Forums > Programming syntax error near unexpected token in bash using perl User Name Remember Me?

I am using Perl version 5.10.1 on Ubuntu 11.04. Command is: sh -c '(perl -pi -e \'print "TextContents" if $.==13\' "/usr/local/etc/stunnel/stunnel.conf")' bash: syntax error near unexpected token `"/usr/local/etc/stunnel/stunnel1.conf")'' If someone can help me, it would be great! You can do this in shell: echo "a ' quote"' and a " quote' outputs: a ' quote and a " quote [download] So you can do your pipeline something like http://back2cloud.com/syntax-error/perl-while-syntax-error.php As for sed -i not being portable, that can be worked around w/ temp files -- which might be a safer way of doing things anyway.

Can a bike computer be used on the rear wheel? first order condtion of Lagrangian Is this alternate history plausible? (Hard Sci-Fi, Realistic History) Reduce function is not showing all the roots of a transcendental equation Why not to cut into What does the image on the back of the LotR discs represent? perl -nle 'print for m/\* Members= (\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*([,])*)*$/i)/g' returns bash: syntax error near unexpected token `)' It seems the regex is not playing well with the shell.

Code: # set insert line # L=13 # set insert text I="TextContents" # set insert file F="/usr/local/etc/stunnel/stunnel.conf" sed -i "${L}i${I}" ${F} BTW, I suspect the cause of your problem is shell Regards Ambrish kambrish View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by kambrish 06-21-2007, 02:16 AM #5 kambrish LQ Newbie Registered: As it's currently written, it’s hard to tell exactly what you're asking. So you/we are stuck w/ what is there.

Remove advertisements Sponsored Links pludi View Public Profile Find all posts by pludi

« Previous Thread | Next Thread » Thread Tools Show Printable Version Email this Page Subscribe to Problem to left align within a split Does the code terminate? perl -nle' print "$1 => $2" while /^(?!#)(loop_.+rev).+?[\x27\"|](.+?)[\x27\"|]$/g; ' non-hadoop.env [I added some line breaks for readability. In fact why are you using either? -- Can't you just put the perl command directly into the script? ==> Project is already developed.

What is a tire speed rating and is it important that the speed rating matches on both axles? while (my $line = ) { –ikegami Dec 20 '13 at 15:12 1 I'm sorry, how is this off topic?