@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28



Comments:

<0> I mean simplified of course
<1> the OS generally goes fast
<1> but it won't be more expensive than a local pipe connection in general
<0> it takes the values as the maximum
<2> merlyn, ok
<1> just the rendevous is via socketname space not from a common parent
<0> anyway, I think my problem comes with the match, because game contains "["
<3> g0th - can we try it a different way
<1> in fact socketpair() is really pipe()
<1> or vice versa
<4> j2daosh: in the part1 subroutine you have: while() { if (...) { } else { while() { ... } }; the while inside the else-block is causing you problems. If you use last then it ends the currenty while loop. So inside the else-block you are ending the inner-loop but not the outer-loop. (Meaning your code will never stop if you remove $year == "2010" (and note: that really should be: $year == 2010))
<3> what I think is going on is that you have a string that keeps getting changed as long as a function call is true
<3> what would help me help you
<3> is instead of seeing code
<0> yes
<3> give me an example from the beginning - and how that string changes over subsequent function calls



<3> so I just see
<3> 'starting string'
<0> I have 50000 files
<3> 'asdf' after call 1
<3> 'asdf 235' after call 2
<3> 'asdf 42' finished
<1> j2daosh - that sounds complex
<0> they all contain strings like ;B[aa];W[ad];B[ss];W[....
<3> g0th - I don't care about that - just take one example and show me the results of doing it by hand
<0> I try to find the most common ";B[??]" and save it to $game
<3> then it can be automated
<0> ok
<3> in nopaste
<3> not in the channel
<5> oh thats why it keeps going and i cant kill it!!
<5> i was trying to find it
<0> the first run is ok (when $game="")
<0> so I give an example when the function is called the 2nd time
<5> i didn't know that it only killed the one loop... i thought last; only worked for the while
<4> j2daosh: to make things worse: in sub part1 you don't even need a while loop.
<5> i dont have a while in sub part1
<5> oh nevermind
<5> i fdo
<4> j2daosh: you have 2. (or atleast in the code you pasted)
<0> $game=";B[pd]", $line =";B[pd];W[aa];...", I want to match this because it starts with "$game;W[??]"
<5> yeah i do... was looking at the wrong part
<0> then I want to take aa and store it in some list
<5> so i can take out the first while () and it will stop the looping thing right?
<5> i have a last; for the second one...
<3> ok - g0th, got that much
<5> and i want the script to keep going till it hits year 2010, by then i better have a different language under my belt and this script rewrote already
<0> then later on, some entry of that list (maximum value) is choosen for the next function call
<0> $game="$game;W[aa]" eg
<0> the B/W thing changes in each step, but you can basically ***ume it's always B
<0> (I got that thing solved)
<3> ok - so you have 2 tasks that I can see
<3> the first is that you need to find 1 string that begins with another (known) string but is followed by some pattern
<0> I should remark that this is probably a very bad algorithm, but it's just for once
<3> the next step is to extract part of that pattern for later use
<0> yes
<3> ok - that's fairly easy
<0> yes ;)
<0> probably
<3> my $prefix = quotemeta $game;
<0> hmm, I tried that, and it didn't work
<0> besides doesn't this add consecutive "[" ?
<3> then /^$prefix\[([a-s]{2})\]/
<3> I wasn't done
<0> sorry
<3> you have to quotemeta the $game because it contains some meta characters and you want to match it literally
<3> you then need to escape the open and close ]
<3> but you want to capture what's inside those brackets
<0> I don't follow :(
<3> hrrm
<0> hmm
<0> ahh
<3> ok - forget what comes after $game for a second
<5> brb
<5> bbiaf acutlaly
<0> I think I follow now
<5> actually*



<5> jess
<3> /$game/ is wrong because $game contains meta characters
<5> jeez
<3> so using a temporary variable is in order
<3> my $prefix = quotemeta $game;
<0> I tried that
<3> now - you can treat $prefix as a literal
<0> really?
<6> Limbic_Region: one can also use \Q and \E
<0> it also escapes ";"
<0> etc
<3> so /^$game/ will match anything that starts with the same as $game
<3> so if $game = ';[1234]'
<3> and $somestring = ';[1234] % 67';
<3> then
<3> $somestring =
<3> err
<3> $somestring =~ /^$prefix/; # will match
<3> when
<3> $prefix = quotemeta $game;
<3> so - ***uming you understand that part
<4> j2daosh: in part1() you check if a certain file exists in a certain directory. But you don't use that in part2 or part3?
<3> you just need to move on to what comes AFTER the prefix
<0> hmm, I must have messed up elsewhere then
<0> because exactly sthg like that didn't work for me
<0> but it worked if I hardcoded it
<0> oeh
<0> sorry
<3> well, I can show you using a 1 liner if you would like to see proof
<0> I believe
<3> ok
<0> I will try again
<3> rindolf - there is a reason I didn't use \Q and \E but yes, that is an alternative
<6> Limbic_Region: OK.
<3> I didn't think /^\Q$var\E/ would interpolate to be honest
<3> and if it did - it would just be confusing
<3> so g0th - ***uming you have matched the prefix of the string - you just need to worry about what comes next
<3> so let's say you wanted to match everything in $game and then W[aa]
<3> you would do
<3> /^$prefixW\[([a-s]{2})\]/
<3> rindolf - IOW, first interpolate $var and then escape it - I would think it would just escape $var as \$var
<7> ive seen the expression "defined $1" and "$1" been used regexes, what are thir purpose?
<7> their*
<3> opus21 - they are match variables
<3> for instance
<7> ..
<3> if ( 'foobar' =~ /(foo)(bar)/ ) { # $1 = foo, $2 = bar }
<3> see perldoc perlre and perldoc perlvar
<8> perlre - Perl regular expressions, the rest of the story. To access this perldoc please type, at a command line, 'perldoc perlre'. You may also find it at http://perldoc.perl.org/perlre.html
<9> Ah, there it is: no closing curly: it's commented out! ;)
<3> Juerd - no its not, the client ate the newline
<7> Limbic_Region, i see, soo.. i could swap the words around?
<9> Limbic_Region: There are no newlines in irc, so if your client lets you ENTER it, it's broken :)
<3> yes
<3> Juerd - on the internet, no one knows you're a dog
<9> Limbic_Region: How do you know that then?
<7> Limbic_Region, but the variables, are only the content, within the parentheses?
<3> opus21 - capturing parens yes - you really should RTFM (I provided 2 good resources)
<7> Limbic_Region, believe me i will. big thanks mate
<10> GumbyBRAIN: NAN
<11> Damn. Too many links to @shark_legal_firms.
<9> Limbic_Region: Are you sure?
<3> no
<3> if I were sure - I would know something right
<9> Exactly
<9> But are you sure you're not sure? :)
<9> etcetera
<3> of course, I could always say I have a buddy named nothing and all would be good
<9> Limbic_Region: nothingmuch? :)
<9> It could be an abbrev.


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #perl
or
Go to some related logs:

nsplugin64 -index
#math
#lisp
php 5 mem leak()
saa7134-alsa debian
#ubuntu
glxinfo hangs
#math
#linux
icandy for ubuntu



Home  |  disclaimer  |  contact  |  submit quotes