Load an hash from a text file

From: Web Solving (websolving_at_gmail.com)
Date: 02/28/05


Date: Mon, 28 Feb 2005 13:48:27 +0100
To: Perl BG <beginners@perl.org>

i rebuilt the scipt without using any hash in this way:

open(INFILE,"lista.txt") || die "Cant read lista.txt. Reason: $!";

while( <INFILE> ){
   my ($search, $replace) = split /|/;

open(READIT,"testo.txt") || die "Cant read file.txt. Reason: $!";
open(WRITEIT,">>testo_new.txt") || die "Cant write file_new.txt. Reason: $!";
 while (<READIT>) {
   $riga = $_;
   $riga =~ s/$search/$replace/;
   
   print WRITEIT "$riga\n";
    
 
 }
close(WRITEIT);
close(READIT);

lista.txt is created like:

Lao Tzu|<\a href="http:\/\/www\.taolaotzu.it>Lao Tzu<\/\a>
Tao|<\a href="http:\/\/www\.confucio.it>Tao<\/\a>
drake|<\a href="http:\/\/www\.dragoni.it>drake<\/\a>
the drake|<\a href="http:\/\/www\.dragoni.it>the drake<\/\a>

typing the command to execute my script a message is show:

Missing right curly or square bracket at search-and-substitute line
17, at the end of line
syntax error at search-and-substitute line 17, at EOF
Execution of search-and-substitute aborted due to compilation errors.

i can't understand what i've to do.

-- 
WebSolvingJaa: informatica per il web e l'azienda.
http://websolvingjaa.altervista.org/


Relevant Pages

  • Re: Fetch without Execute...
    ... and the simple logic in the script is performing as desired. ... If you fix the execute, ... The execute fails because there's a syntax error in the SQL, ... of interpolating external data directly into an SQL statement. ...
    (perl.dbi.users)
  • Re: problem with if command
    ... I have one script which is given below. ... But when i try to execute this script i get syntax error like ... No need for two greps (and some will say that there's no need for ...
    (comp.unix.shell)
  • Re: problem with if command
    ... I have one script which is given below. ... But when i try to execute this script i get syntax error like ... But it may happen for some other reasons. ...
    (comp.unix.shell)
  • Re: problem with if command
    ... neohunts wrote: ... I have one script which is given below. ... But when i try to execute this script i get syntax error like ...
    (comp.unix.shell)
  • Re: Will Linux become as vulnerable as MS ??
    ... > beeing vulnerable to viruses. ... > that they know are executable, and execute intentionally. ... >> Linux, each distro is a little different, and even within the distro, ... > Since clicking on a script is easier than typing it's name, ...
    (comp.os.linux.security)