For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > August 2007 > Barewood found where operator expected?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Barewood found where operator expected?
Mojorising

2007-08-28, 7:01 pm

Hello! I am trying to write a simple Perl script to edit a file using
two other source files named infra_east.txt and infra_west.txt. Please
excuse my ignorance on this. I'm sure there are much smarter ways to
achieve what I'm trying to achieve but this is the best I found so
far. It's my first time dabbling with Perl.

When I type this into the console:
perl -i.old -p -e /s/$(cat infra_east.txt)/$(cat infra_west.txt)/ig
configfile.cfg

I get this:
Barewood found where operator expected at -e line 1, near "/s/emile"
(Missing operator before emile?)
syntax error at -e line 1, near "/s/emile"
Excecution of -e aborted due to compilation errors.

I basically copied an example from this page below. It worked when I
tested it before. Not sure what's different. I have tried lots of
variations on my line above. It appears exactly the same as what's on
that page and my test script.
http://open.itworld.com/nl/unix_sys_adm/09252002/

The weirdest thing is that when I put this"barewood" error message
into Google, it returned 0 results.

Hopefully someone out there can give me a shove in the right direction
on how I can make it work. The issue seems like something very small.

Thanks for any help!

Mike

PS: Please do not reply via e-mail as this account has not been in use
for years.

Peter Scott

2007-08-29, 7:59 am

On Tue, 28 Aug 2007 08:58:58 -0700, mojorising wrote:
> When I type this into the console:
> perl -i.old -p -e /s/$(cat infra_east.txt)/$(cat infra_west.txt)/ig
> configfile.cfg
>
> I get this:
> Barewood found where operator expected at -e line 1, near "/s/emile"

[...]
> The weirdest thing is that when I put this"barewood" error message
> into Google, it returned 0 results.


Your post contains the word "barewood" three times without once using the
word that perl really outputs for this error, which is "bareword". If
you're really seeing "barewood" then you have somehow got a corrupted perl
executable or seriously malfunctioning computer and I would stop using
both of them until you can get them analyzed and fixed.

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/

Steven M. O'Neill

2007-08-29, 9:59 pm

Peter Scott <Peter@PSDT.com> wrote:
>On Tue, 28 Aug 2007 08:58:58 -0700, mojorising wrote:
>[...]
>
>Your post contains the word "barewood" three times without once using the
>word that perl really outputs for this error, which is "bareword". If
>you're really seeing "barewood" then you have somehow got a corrupted perl
>executable or seriously malfunctioning computer and I would stop using
>both of them until you can get them analyzed and fixed.


Or at least buy some shellac.

--
Steven O'Neill steveo@panix.com
Brooklyn, NY http://www.panix.com/~steveo
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com