You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or API help for more information.
<?xml version="1.0"?>
<api>
  <query-continue>
    <allpages gapfrom="Sort by any order" />
  </query-continue>
  <query>
    <pages>
      <page pageid="9" ns="0" title="Regex quiz">
        <revisions>
          <rev xml:space="preserve">'''q1.pl'''
 which is different ?
 /&quot;(.*)&quot;/
 /&quot;([^&quot;]*)&quot;/
 /&quot;(.*?)&quot;/

'''q1-b.pl'''

$line1='xx&quot;yyy&quot;x';

$line2='xx&quot;yy&quot;zz&quot;x';

($a) = $line1 =~ /&quot;(.*)&quot;/;

($b)= $line1 =~ /&quot;([^&quot;]*)&quot;/;

($c)= $line1 =~ /&quot;(.*?)&quot;/;

print &quot; line1 = $a, $b, $c\n&quot;;

($a) = $line2 =~ /&quot;(.*)&quot;/;

($b)= $line2 =~ /&quot;([^&quot;]*)&quot;/;

($c)= $line2 =~ /&quot;(.*?)&quot;/;

print &quot; line1 = $a, $b, $c\n&quot;;


'''q2.txt''' 
 capture data into 2 variables- data after n until the next tab or the end and data after e
 if there is e until the end
 example:
 'nxxxxxx\teyyyyyyyy'
 $n=xxxxxx
 $e=yyyyyyyy
 or
 'nxxxxxx'
 $n=xxxxxx
 $e=

'''q2.data'''

nxxxx   eyyyyyy

nxxxxx

'''q2-a.pl'''

open IN,&quot;q2.data&quot;;

while ($line=&lt;IN&gt;){

chomp $line;

my ($n,$e)= $line=~ //;

print &quot;n=$n,e=$e\n&quot;;


}


'''q2-b.pl'''

open IN,&quot;q2.data&quot;;

while ($line=&lt;IN&gt;){

chomp $line;

my ($n,$e)= $line=~ /[ne]([^\t]+)\t?/g;

my ($n,$e)= $line=~ /n([^\t]+)(?:\te([^\t]+))?/;

print &quot;n=$n,e=$e\n&quot;;

}


'''q3.txt'''
 capture data beween pairs of $$ with a letter after it, but if there is a single $ then it
    is   data
 and not a separator
 $a='AAAA'
 $b='BBB$BB$BBB'
 $c='CCCC'
 or $array[1]='AAAA'
   $array[2]='BBB$BB$BBB'
   $array[3]='CCCC'

 and there can be more...

'''q3-a.pl'''

$line='$$aAAAA$$bBBB$BB$BBB$$cCCCC';

@fields=$line=~//;

($a,$b,$c)=$line=~//;

print &quot;@fields\n&quot;;

print&quot;a=$a,b=$b,c=$c&quot;;


'''q3-b.pl'''

$line='$$aAAAA$$bBBB$BB$BBB$$cCCCC';

@fields=$line=~/\$\$\w((?:(?!\$\$).)*)/g;

print &quot;@fields\n&quot;;


'''q4.txt'''
 capture a number of unknown length in a text that follows ab or a but cannot have a c after it
 example
 ab123c or a123c
 $num=''
 
 ab123x or a123x
 $num='123'
 
 a1z or ab1 z
 $num='1'

'''q4.data'''

xxxxab123cxxxx

xxxxab123xxx

xxxa12345xxxx

xxxxb123xxx

xxxa1234cxxxx


'''q4-a.pl'''

open IN,&quot;q4.data&quot;;

while ($line=&lt;IN&gt;){

chomp $line;

print &quot;line = $line\n&quot;;

($n)=$line=~/ab?(\d+)[^c\d]/;

print &quot;n=$n\n&quot;;

}


'''q4-b.pl'''

open IN,&quot;q4.data&quot;;

while ($line=&lt;IN&gt;){

chomp $line;

print &quot;line = $line\n&quot;;

$line=~s/ab?(\d+)c//;

($n)=$line=~/ab?(\d+)/;

print &quot;n=$n\n&quot;;

}

'''q5.txt'''
 separate a line by commas. If there are quotation marks, take what is inside the quotes. If there is a comma inside quotes, it is a literal not a separator
 
 example: &quot;aaaa&quot;,&quot;bbb,bbbb&quot;,ccc,dddd
 $a=aaaa
 $b=bbb,bbbb
 $c=ccc
 $d=ddd

'''q5-b.pl'''

$a='&quot;aaaa&quot;,&quot;bbb,bbbb&quot;,ccc,dddd';

@arr=$a=~//;

foreach (@arr){

print&quot;***$_******\n&quot;;

}

[[Category:Sample code]]
[[Category:Quizzes]]</rev>
        </revisions>
      </page>
      <page pageid="174" ns="0" title="Simple server with perl">
        <revisions>
          <rev xml:space="preserve">Run it and in another window, run:

&lt;pre&gt;
telnet localhost 2345
&lt;/pre&gt;

&lt;pre&gt;
    use strict;
    BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
    use Socket;
    use Carp;
    my $EOL = &quot;\015\012&quot;;

    sub logmsg { print &quot;$0 $$: @_ at &quot;, scalar localtime, &quot;\n&quot; }

    my $port = shift || 2345;
    my $proto = getprotobyname('tcp');

    ($port) = $port =~ /^(\d+)$/                        or die &quot;invalid port&quot;;

    socket(Server, PF_INET, SOCK_STREAM, $proto)        || die &quot;socket: $!&quot;;
    setsockopt(Server, SOL_SOCKET, SO_REUSEADDR,
                                        pack(&quot;l&quot;, 1))   || die &quot;setsockopt: $!&quot;;
    bind(Server, sockaddr_in($port, INADDR_ANY))        || die &quot;bind: $!&quot;;
    listen(Server,SOMAXCONN)                            || die &quot;listen: $!&quot;;

    logmsg &quot;server started on port $port&quot;;

    my $paddr;

    $SIG{CHLD} = \&amp;REAPER;

    for ( ; $paddr = accept(Client,Server); close Client) {
        my($port,$iaddr) = sockaddr_in($paddr);
        my $name = gethostbyaddr($iaddr,AF_INET);

        logmsg &quot;connection from $name [&quot;,
                inet_ntoa($iaddr), &quot;]
                at port $port&quot;;

        print Client scalar localtime;
        print Client $EOL;
        print Client &quot;Hello there&quot;,$EOL;
    }
&lt;/pre&gt;</rev>
        </revisions>
      </page>
    </pages>
  </query>
</api>