Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created November 6, 2012 13:43
Show Gist options
  • Save ynonp/4024814 to your computer and use it in GitHub Desktop.
Save ynonp/4024814 to your computer and use it in GitHub Desktop.
xml from perl
use strict;
use warnings;
use v5.14;
use Spreadsheet::ParseExcel::Simple;
use Term::ANSIColor;
my $xls = Spreadsheet::ParseExcel::Simple->read('hello.xls');
my $sum = 0;
foreach my $sheet ($xls->sheets) {
while ($sheet->has_data) {
my @data = $sheet->next_row;
print color $data[2];
say "@data";
print color 'reset';
}
}
use strict;
use warnings;
use v5.14;
use XML::Mini::Document;
use Data::Dumper;
use File::Slurp;
my $xml_string = read_file('a.xml');
my $xmlDoc = XML::Mini::Document->new();
$xmlDoc->parse($xml_string);
my $xmlHash = $xmlDoc->toHash();
say $xmlHash->{books}->{book}->{title};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment