Re: Could you give me some explanatio​ns about regex?

2014-07-15 Thread Brandon Allbery
On Tue, Jul 15, 2014 at 11:16 AM, MAX PUX wrote: > I expected this output: > website > ForeignAssistance > ForeignAssistanceRow > AssistanceType > RecipientCountry > ProgramName > > but the output was: > > └website┐ > > └ForeignAssistance┐ > > └ForeignAssistanceRow┐ > $/[0] is a Match object, wh

Re: Could you give me some explanatio​ns about regex?

2014-07-15 Thread Pawel Pabian
Hi You can force correct stringification method by explicit convaersion say $/[0].Str or using print which uses it implicitly print $/[0] ~ "\n" bbkr On 15 Jul 2014, at 17:16, MAX PUX wrote: > I've written this code: > use v6; > > my $file =3D open "us_foreign_assistance.xml"; > > for $

Could you give me some explanatio​ns about regex?

2014-07-15 Thread MAX PUX
I've written this code: use v6; my $file =3D open "us_foreign_assistance.xml"; for $file.lines -> $line { extract($line); } sub extract($line) { if $line ~~ m/ \< (\w+) \> / { say $/[0]; } } The xml file contains: < ?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"yes"?