| |
| |
| |
|
Comments:
<0> while (<IN>) { chomp; if (m/blah/nblah/) { $found = $_,; last; } } <0> how to put 2 lines with blah in $found ? <1> m/blah/nblah/ <-- what is that suppose to do? <0> its an example <0> real thing is <1> give real code if you want real help. pseudo code is no help at all. especially when errornous. <2> laggy connection
<0> example file: <0> blah <0> bleh <0> it can find bah\nbleh <0> now i need to set line with blah and bleh onto 1 string <0> how to do that ? <1> not sure I understand what you mean. <0> hmmm <0> if (m/$find/) { $var = $_,; } <- this puts a line with $find in string right ? <1> that doesn't put anything. it ***ignd to $var if $find is in $_ <0> yes <0> but $_ = line right ? <0> how would you put into $var $_ and the next line ? <1> you haven't read the next line yet. <0> yea, a poimt there <1> set a variable to let you know that you match the previous line and do the proper ***igning on the next line if the vaqriable is set <0> so like i will have to get the current line # and work with line + 1 ? <1> Are you saving the lines you read? if so, maybe you could work on the saved lines (probably in an array) <0> yes <0> i'm saving it <1> well, seems trivial enough then. <0> how would you write this properly ? <0> $myline = $_; if ($myline + 1 =~ m/$find2/) {set $myline2 = $_ + 1; } <1> What do you think $myline + 1 do? <0> just an example :) nothing actually <0> i need to get the number of the $myline first <0> then search nextline
<0> oh i know <0> while (<blah>) { chomp; if (m/$find/) { $myline = $_,; $mynextline = $_; last; } } <0> then we can if $myline = something and $mynextline = something2 ..do stuff <0> mach how would you read a line number "x" from file ? <0> nvm that <3> hi <3> does any one knows a perl script that monitor processes <4> anyone here active?? <5> Please read the topic, thanks. <4> I did chris I need some help......with <STDIN> and converting the input to a hex() value that then prints the value. <5> Did you see the part that says 'if you ask "anyone around?" you get kickbanned. kthx.'? Not that anyone actually gets kickbanned, but the question -is- discouraged. <4> ok <5> Anyway, $value = <STDIN>; $hexstring=sprintf "%x", $value <5> Would work <5> Er. <5> Or print sprintf "%x", $value <5> to print it. <5> Y'know there's probably a printf too. <5> Not that i've ever used it in perl. <5> But I expect it exists. <4> aaahhhhhh <4> :) <4> YAY!!! <4> WORKED <5> you're welcome. <5> Hm, I wonder if there's a way to do it with a regexp. Probably not. <4> that was the problem i was having... <5> It's fundamentally a mathematical problem. <5> Take the modulo 16, convert that into a digit, shift right four bits, and loop. <5> Until 0 is reached.
Return to
#perl or Go to some related
logs:
#linux #chat-world funcolo #india katspaw americanbound #allnitecafe dil pey math ley
sujal+meaning
#chat-world
|
|