Hi -

I understand...

The hash data type is a collection of key/value pairs.
Hash variables are denoted by thr '%' symbol. For example,

 my %somehash;

declares an empty hash variable named 'somehash';

To populate a hash, assign values to keys. If the key doesn't
exist the key is created and assigned the value. If the key
is already present, the value is overwritten. Some examples:

 $somehash{lunch} = 'hamburger';

assigns the value 'hamburger' to the key 'lunch'; we can
assess that value:

 print "$somehash{lunch}\n";

Note hash keys are within curly braces {} and, if they qualify
as a valid perl variable name ([A-X][a-z][0-9]_) they do not need
enclosing quotes. Also note the '%' turns into a '$' when you
access the value.

There is much more to learn about hashes, as well as variables in
general. You should look at:

http://www.perl.org

http://learn.perl.org

as well a some of the links there and take a few of the tutorials
to get up to speed in perl before you tackle your ambitious XML
project.

Aloha => Beau.

-----Original Message-----
From: Admin-Stress [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 09, 2002 12:39 AM
To: perl
Subject: RE: modifying xml entry


Well, of course I dont ask the complete working code ...
English is not my mother language, so maybe my writing was wrong, but I dont
mean that I asked the
complete working code.

Hmm ... I dont understand about 'hash' variable type in perl, could you give
me any 'example' ?

thanks

--- "Beau E. Cox" <[EMAIL PROTECTED]> wrote:
> Hi -
>
> >Could you give me a working perl code to modify the entries? ...
>
> Sorry - that's not the way this list works :)
> How can you learn if we spoon-feed you?
>
> We are more than happy to give you suggestions and point you
> in productive directions. Then, you write the code. If you
> still have problems, then post snippets of your code and
> we will continue to help.
>
> OK, that said, here are my suggestions:
>
> Look at XML::Simple on CPAN. This module loads an XML file
> into a hash (you probably should use forcearray => 1). You
> may then modify that hash based upon user input. Finally,
> print the hash to your output.
>
> Aloha => Beau.
>
> -----Original Message-----
> From: Admin-Stress [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 09, 2002 12:09 AM
> To: perl
> Subject: modifying xml entry
>
>
> Hi,
> I have a XML file like this :
>
> <Config>
>  <FTPServer>
>    <Password>password</Password>
>    <Username>dccftp</Username>
>    <PortNumber>22</PortNumber>
>  </FTPServer>
>  <DCCBox>
>    <IPAddress>127.0.0.1</IPAddress>
>    <Serial>1234567890</Serial>
>  </DCCBox>
> </Config>
>
> Could you give me a working perl code to modify the entries? user will
input
> from keyboard :
>
>   FTPServer
>      Username =
>      Password =
>      Port Number =
>
>   DCCBox
>      IPAddress =
>      Serial =
>
> After this, it will modify that config.xml entry.
>
> I tried to learn XML::Parser, but still I dont understand how to implement
> this.
>
> Thanks.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to