Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Compare two file text input, compare it, replace and write new file

by repellent (Priest)
on Feb 14, 2012 at 06:29 UTC ( #953628=note: print w/replies, xml ) Need Help??

in reply to Compare two file text input, compare it, replace and write new file

You are splitting your source.txt lines with a single whitespace:
my @words = split / /, $s;

For your code to work, source lines have to look like keys separated by single whitespaces.

Hmm.. it seems like split may not be the right tool, since it's hard to specify what to really split on. Try regex search and replace!
# match a backslash followed by two characters, # then compute the replacement by looking into %words $s =~ s{(\\..)}{ $words{$1} || $1 }ge;

Have a look at perlrequick and perlretut. (And follow kcott's advice.)

Replies are listed 'Best First'.
Re^2: Compare two file text input, compare it, replace and write new file
by wa2nlinux (Novice) on Feb 14, 2012 at 23:30 UTC
    the text is already formated, such as
    can I using search replace if the format like in the code above ? because the codes sometime having same first or second characters such as \ha and  \hang My code already work but if I manually add a space after the code  \ha\ca\ra\ka to \ha \ca \ra \ka

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://953628]
[makita]: sign_types parameter in XML::Compile::WSS ::Signature Does have anybody experience how to use it?
[makita]: Need to sign more elements but all types I put in array are ignored. And is always signed only the body
[Discipulus]: no makita sorry. i see in the synopsis of the module: "WARNING: Only limited real-life experience" might be better compose a SOPW with some code example and data
[Discipulus]: ..or inspect the source code of the module
[makita]: I am doing this:
[makita]: my $sig = $wss->signature( schema => $wsdl, token => $token, sign_types=>'wsa: Action','wsa:To', 'wsu:Timestamp', 'wsa:MessageID',' SOAP-ENV:Body', signer=>DSIG_RSA_S HA1, public_key => $cert,
[Corion]: Oof, I haven't done much with signing SOAP requests. markov is usually somebody good to ask via mail ;)
[makita]: I need to create a SOAP call where are signed more types not only the body
[makita]: I am inspecting it second day :)
[makita]: Thanks

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-03-23 08:45 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (285 votes). Check out past polls.