Created
November 6, 2012 13:43
-
-
Save ynonp/4024814 to your computer and use it in GitHub Desktop.
xml from perl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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