view bin/get_xml_image.pl @ 1910:b7b528e9ec5e draft

Implement divide read in word_count ( but cannot running )
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Sun, 19 Jan 2014 22:54:01 +0900
parents 3e1caef39798
children
line wrap: on
line source

#!/usr/bin/perl

use MIME::Base64;
my $image;
my $buf;

while(<>) {
    if (/<image name="(.*)">/) {
	$image= $1;
        $buf = '';
    } elsif (/<\/image>/ ) {
	open(OUT, ">/tmp/$image") ;
	print OUT decode_base64($buf);
        $image = '';
    } elsif ($image) {
	$buf .= $_;
    }
}