#perl - Sat 10 Mar 2007 between 05:36 and 05:46



AnAntI am trying to do a multiline replacement in perl using s/// operator, can someone help ?
I tried @arr = s/line1 match expression
line2 match expression/replacement/
shigetsuAnAnt, did you try the /s modifier?
AnAntbut that did not work
shigetsu: yup
shigetsu: is what I am doing right ?
shigetsupaste the code at http://sial.org/pbot/perl
also, consider using quotemeta.
AnAntshigetsu: does that site run java ?
zamolxesAnAnt: http://perldoc.perl.org/perlretut.html#More-on-characters%2c-strings%2c-and-character-classes read this
shortenzamolxes's url is at http://xrl.us/u9bn
AnAntshigetsu: does that site use java script ?
shigetsusial.org?
AnAntshigetsu: yeah
shigetsuwhy do you want to know?
AnAntshigetsu: to know if I should use elinks or not
shigetsuehm, it's a stupid form. no more or less AFAICT.
but I may be wrong.
pasteling"AnAnt" at 62.114.91.55 pasted "multiline substitute" (3 lines, 71B) at http://sial.org/pbot/23402
shigetsuAnAnt, I have no idea about the input data. Provide the entire script.
zamolxesAnAnt: have you read the link I gave you?
shigetsuAnAnt, you should be using $1$2 instead of \1\2.
AnAntzamolxes: looking at it
zamolxesand ARGH don't parse html with regexps
use a CPAN module for that
shigetsuand you could use s{}{} instead of s///. this will allow you to not escape slashes.
zamolxes, ++.
pasteling"AnAnt" at 62.114.91.55 pasted "multiline substitute" (22 lines, 673B) at http://sial.org/pbot/23403
AnAntshigetsu: escape slashes ?
shigetsuwhat's your question?
AnAntzamolxes: I'm trying to avoid using modules
shigetsunot another one.
AnAntshigetsu: you said: "allow you to not escape slashes"
shigetsu: not another what ?
shigetsudo you want to know what a slash is? and are you using windows?
zamolxesAnAnt: what benefit would that bring? Other than bugs and unmaintainable code already written and tested by somebody else
AnAntshigetsu: a slash is \
shigetsu: no, I use linux
shigetsu\ is a backslash, whereas / is a slash.

Page: 4 11 18 25 32 39 46 53 60 67 74 81 88 

IrcArchive