| |
| |
| |
|
Comments:
<0> Can i replace on "nextline" $file =~ s/$find/\n/g; <- doesn't work <1> /\? <2> zeeee, it isn't clear what the problem you are experiencing is. <2> If your problem is one of changing lines in a file? look at perl's Tie::File. http://perldoc.perl.org/Tie/File.html <0> i'm trying to replace each $find on "next line" in file but it doesn't work <0> like to make an \n instead of $find <0> but it prints "\n" in files without changing to next line <2> what is $file ? <2> does $file contain the contents of a file ? <0> yes <1> tc all, gbu <0> open (blah,...
<0> $file = <blah> <2> but that only puts a single line into $file <3> bad connection <2> <0> open (blah,... <2> <0> $file = <blah> <2> <2> but that only puts a single line into $file <2> open FH,"file.txt"; read FH, $file, -s FH; <- that would put the contents of the file into $file. <3> yes <3> print blah "\n"; <2> http://perldoc.perl.org/functions/-X.html <- documents -s <3> that would make a jump to next line right ? <3> i want to find each $find in file and replace it on "jump to next line" <3> i did nibble <3> there nothing there exept \n <3> wich doesnt work in this case <3> nvm <2> Do you mean if a line in the file is "ok\n" you want it to become "\n" ? <2> or do you want "ok\n" to become "ok\n\n" ? <3> :) <2> So? <3> i have this <3> blah bah blah BRAKE ha ha ha BRAKE <3> in 1 line in file <3> i want to make it <3> blah bah blah <3> ha ha ha <3> replace BRAKE on next line <3> replace BRAKE on \n <3> but i can't <3> $file =~ s/BRAKE/\n/s; just prints "\n" instead of brake, and not the actual jump to next line <3> u know how to make it skip lines ? <3> rofl <3> this does it <3> s/$find/\r\n/s; <2> heh, you want "a b c BREAK d e f BREAK" into "a b c \n d e f \n" <2> that's my understanding so far. <3> are u high ? <3> :) <3> i allready figured out how <3> thanks :) <2> No. I think you need to improve your english. <2> np <3> yes <3> i do <2> unix:~$ perl -we 'use Data::Dumper; $Data::Dumper::Useqq=1; $_="a b c BREAK d e f BREAK"; s/BREAK/\n/g; print Dumper $_' # outputs: $VAR1 = "a b c \n d e f \n"; <3> :D <3> try this
<3> searchreplace("break","test.txt"); sub searchreplace { my ($find, $file) = @_; open (INSR, "$file") || die("Error Reading File: $file $!"); { undef $/; $infile = <INSR>; } close (INSR) || die("Error Closing File: $file $!"); $infile =~ s/$find/\r\n/g; open (OUTSR, ">$file") || die("Error Reading File: $file $!"); print OUTSR $infile; close (OUTSR) || die("Error Closing File: $file $!"); } <3> this works ^^ <3> it erases every "break" and jumps to next line <4> heh <5> guys <5> guys, how can i make text boxes to capture NUMBERS. it seems to only accept number, not forwarding it to my mail --> appears as $contactnum. any idea <5> btw, it's a cgi script (perl) <6> uhm. <5> any idea? <6> I don't think I understand the problem. <6> But if you've got a cgi that is capturing input boxes, if($input =~ /^\d+$/) would test that the input is entirely digits. <5> ChrisA <5> here's the script > http://pastebin.com/546682 <6> okay, so what's it doing wrong? It doesn't give an error but doesn't send email? <5> hmm <5> yeah <5> using sendmail as the external mail pipe <5> i have all the information <6> Are you sure $sendmail is pointing at the right place? Are you sure mail works on that box? <5> except for the contact number <5> yeah <5> i got all my mail <5> but the the " $contact " <5> it accepts numbers in the address line though <6> Maybe it's because you're including '&contactnum' isntead of '$contactnum' in what you print to sendmail? <6> Which will try to run contactnum as a function, not evaluate it as a scalar. <6> Actually, I guess since it's quoted it wouldn't even do that. I'd expect it to email you a literal '&contactnum'. <5> uh <5> wait <5> OMG <5> lol <5> ChrisA <5> thanks for spotting that <5> now i remember <6> np. It was a different color in the pastebin, kinda stood out. <5> i was combining command in a terminal <5> kinda got 'used' to that && <5> uh <5> sorry <6> You should use a colorizing editor. <6> vim and emacs can both color perl. <5> i'm using gedit <5> and nano <5> gedit (same color for & and $) <5> nano ( u bet - black and white) <5> hehehe <5> thanks man <5> will use emacs or vim later <6> Hmm. <6> & and $ should definitely not be the same color. <6> That's just bad. <7> hi, anyone here? <2> yes? <6> Only on odd Thursdays. <6> Oh, wait, ... err... I guess that's a yes.
Return to
#perl or Go to some related
logs:
#chat-world trvesti #india #kl #allnitecafe #india bau pantat wordchat girls #allnitecafe #india
|
|