Welcome to Perl and to the monastery
Arenas,
powershell is not a programming language, so you probably can profit from some basic reading about Perl as the book Beginning Perl or the (old but still usefull) Perl Cookbook.
Some sparse suggestion being you new to Perl and using winz: you can check if you have a Perl's module installed with a simple oneliner (take a look at
perldoc about command line switches)
perl -MNot::Installed::Module -e "1"
You are executing (-e) an always-return-true mini Perl program (what is inside the doublequote) but loading some module (after the -M ) before runnig the code. You obviosly get:
Can't locate Not/Installed/Module.pm in @INC (@INC contains:...
You can install modules using the cpanp client (working in the strawberry Perl distro on which DWimPerl is built)
cpanp -i Not::Installed::Module
Choose carefully module to install and use: XML::Simple is simply deprecated. Other modules are better but you need to learn how to use them: the following, working, code uses XML::Twig for xml parsing: anyway, even if you use a good module, xml parsing is a little triky and shaggy thing.
#!perl
use strict;
use warnings;
use XML::Twig;
my $t= XML::Twig->new(pretty_print => 'indented',
twig_handlers => {
'city/name'=>sub{ print $_[1]->text,"\n"; }
+,
'city/population'=>sub{ print "Pop: ",$_[1]
+->text,"\n"; },
}
);
$t->parseurl('http://athome.myminicity.com/xml');
__OUTPUT__
AtHome
Pop: 18998557
As last suggestion, when asking here at perlmonks, do your best to present a simple and fully understandable question, with code that reproduce the error you are facing, or being clear about data you have and data you want to get back from your program. Asking clear question let you to have in return good answers, sometimes real gems, lurking here very wise and experienced programmers (not me).
htH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.