I'm happy when I can use the .. and ... operators in p5, thanks for the tip on the p6 analog! -y
On Sat, Aug 11, 2018 at 1:44 AM, Simon Proctor <simon.proc...@gmail.com> wrote: > One thing your example you'll lose the second <\div>. > > ff is great for working though lines of data. Going back to your previous > example say we have a file like. > > A > B > C > D > E > F > G > > And we want to print the lines from C to F we can write. > > for "file".IO.lines { > print if /C/ ff /F/; > } > > Each line in the file is assigned to $_. If ff has not seen the LHS (so C) > yet it will compare the line to that if it matches (and it doesn't match the > RHS) it returns True. It continues to return True until the line matches the > RHS. At which point I *think* it resets to Looking for the LHS and returning > False. > > The more I think about ff and fff the more I'm mind blown, operators that > remember state? Whacky. > > But anyway I hope that helped a bit. The gather example might be closer to > what you're looking for, putting lines into an array for further looking at. > > Or.... Take a look at DOM::Tiny which might also help you out. > > Hope that helped, I should get up and start the drive to Scotland soon. > > On Sat, 11 Aug 2018, 06:41 ToddAndMargo, <toddandma...@zoho.com> wrote: >> >> On 08/10/2018 08:59 PM, ToddAndMargo wrote: >> > >> >> On Fri, Aug 10, 2018 at 8:16 PM, ToddAndMargo <toddandma...@zoho.com> >> >> wrote: >> >>> Hi All, >> >>> >> >>> I was thinking of doing a >> >>> >> >>> $ p6 'my $x="a\nb\nc\nd\n"; say "$x\n"; $x ~~ s/ .*?c /c/; say "$x";' >> >>> a >> >>> b >> >>> c >> >>> d >> >>> >> >>> >> >>> c >> >>> d >> >>> >> >>> >> >>> Except the real deal will be across 1460 lines. Am I pushing the >> >>> limits? >> >>> >> >>> There are other ways of doing what I want. >> >>> >> >>> >> >>> Many thanks, >> >>> -T >> > >> > >> > On 08/10/2018 08:29 PM, yary wrote: >> > > 1460 lines, at an average of say, oh, 70 characters per line, that's >> > > oh 100k or so? Sounds like a piece of cake... try it and see >> > > -y >> > > >> > > >> > >> > Hi Yary, >> > >> > I will. >> > >> > This is what I am after: >> > >> > <div class="form-group version_row"> >> > <label for="" class="col-lg-4 >> > control-label">Version:<span class="require">*</span></label> >> > >> > <div class="col-lg-8"> >> > <select name="version" class="form-control"> >> > <option value="9.2.0.9297" >> > >9.2.0.9297</option><option value="8.3.6.35572" >8.3.6.35572</option> >> > </select> >> > </div> >> > </div> >> > >> > >> > $WebPage ~~ s/ . * '<div class="form-group version_row">'//; >> > $WebPage ~~ s/ '</div>' .* //; >> > >> > >> > Then >> > >> > ( $NewRev = $Webpage ) ~~ s/ .*? '<option value="'//; >> > $NewRev ~~ s/ '"' .* //; >> > >> > I may have to fuss with the escapes. >> > >> > I do so adore Perl! >> > >> > :-) >> > >> > -T >> >> >> I have done this with two web pages already. Perl 6 >> eat its lunch! >> >> -- >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> Computers are like air conditioners. >> They malfunction when you open windows >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > -- > Simon Proctor > Cognoscite aliquid novum cotidie