[Bangalore-pm] Bangalore-pm Digest, Vol 56, Issue 2
Sandeep Nyamati
donks122 at gmail.com
Fri Nov 8 07:51:57 PST 2013
Hey Satya,
Try this out. :)
use XML::Simple;
use Data::Dumper;
my $xml = '<IDs>
<child1>
<Group>group1</Group>
<Code>code1</Code>
<Division>division1</Division>
<Department></Department>
<Class>1512</Class>
</child1>
<child2>
<Group>Group2</Group>
<Code>Code2</Code>
<Division></Division>
<Department></Department>
<Class>1010, 1015, 1020</Class>
</child2>
</IDs>';
my $ref = XMLin($xml);
warn Dumper $ref;
Regards,
Sandeep
On 08-Nov-2013, at 9:05 PM, bangalore-pm-request at pm.org wrote:
> Send Bangalore-pm mailing list submissions to
> bangalore-pm at pm.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.pm.org/mailman/listinfo/bangalore-pm
> or, via email, send a message with subject or body 'help' to
> bangalore-pm-request at pm.org
>
> You can reach the person managing the list at
> bangalore-pm-owner at pm.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Bangalore-pm digest..."
>
>
> Today's Topics:
>
> 1. XML to PERL (Satya..)
> 2. Re: XML to PERL (promit)
> 3. Re: XML to PERL (Satya..)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 8 Nov 2013 16:30:15 +0530
> From: "Satya.." <satya.itguy at gmail.com>
> To: bangalore-pm at pm.org
> Subject: [Bangalore-pm] XML to PERL
> Message-ID:
> <CAOzCGu6aLne=sotsomXWi7JNugo3LjSAuiXiCPMeESyOj7a=uw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi All,
>
> We are having one small XML file which has below format
>
> <IDs>
> <*child1*>
> <Group>group1</Group>
> <Code>code1</Code>
> <Division>division1</Division>
> <Department></Department>
> <Class>1512</PSA>
> </*child1*>
> <*child2*>
> <Group>Group2</Group>
> <Code>Code2</Code>
> <Division></Division>
> <Department></Department>
> <Class>1010, 1015, 1020</PSA>
> </*child2*>
> ---
> ---
> ---
> </IDs>
>
>
> I need to write a perl script to capture the values into variables
>
> I got confused how to handle different childs in Perl .. Child1..Child2
>
> Any sample perl script will be helpful to me
>
>
> -------------------------------------------
>
> Regards, J
> *$@tya..*
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.pm.org/pipermail/bangalore-pm/attachments/20131108/52ce2f0c/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 8 Nov 2013 16:41:30 +0530
> From: promit <promitbhattacharya at gmail.com>
> To: "Bangalore.pm" <bangalore-pm at pm.org>
> Subject: Re: [Bangalore-pm] XML to PERL
> Message-ID:
> <CAArv6qPJVDO9rv8eTd62njq2L0_hqHXd1QXoEqawCOAULaD7Zw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> just use XML::Simple
>
> it will read it into a perl reference and then say something like
> $ref->{IDs}->{Child1}
>
>
> On Fri, Nov 8, 2013 at 4:30 PM, Satya.. <satya.itguy at gmail.com> wrote:
>
>> Hi All,
>>
>> We are having one small XML file which has below format
>>
>> <IDs>
>> <*child1*>
>> <Group>group1</Group>
>> <Code>code1</Code>
>> <Division>division1</Division>
>> <Department></Department>
>> <Class>1512</PSA>
>> </*child1*>
>> <*child2*>
>> <Group>Group2</Group>
>> <Code>Code2</Code>
>> <Division></Division>
>> <Department></Department>
>> <Class>1010, 1015, 1020</PSA>
>> </*child2*>
>> ---
>> ---
>> ---
>> </IDs>
>>
>>
>> I need to write a perl script to capture the values into variables
>>
>> I got confused how to handle different childs in Perl .. Child1..Child2
>>
>> Any sample perl script will be helpful to me
>>
>>
>> -------------------------------------------
>>
>> Regards, J
>> *$@tya..*
>>
>>
>> _______________________________________________
>> Bangalore-pm mailing list
>> Bangalore-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/bangalore-pm
>>
>
>
>
> --
> ~ Sent from a plain old fashioned device called a komputarrrr ;)
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.pm.org/pipermail/bangalore-pm/attachments/20131108/84eda090/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Fri, 8 Nov 2013 21:05:54 +0530
> From: "Satya.." <satya.itguy at gmail.com>
> To: "Bangalore.pm" <bangalore-pm at pm.org>
> Subject: Re: [Bangalore-pm] XML to PERL
> Message-ID:
> <CAOzCGu6mGG9HNZRDWPkBoDZa8SGrp-L+3bs9Bk1r4LEjwxZsyQ at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> The child name is dynamic
> On 8 Nov 2013 16:41, "promit" <promitbhattacharya at gmail.com> wrote:
>
>> just use XML::Simple
>>
>> it will read it into a perl reference and then say something like
>> $ref->{IDs}->{Child1}
>>
>>
>> On Fri, Nov 8, 2013 at 4:30 PM, Satya.. <satya.itguy at gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> We are having one small XML file which has below format
>>>
>>> <IDs>
>>> <*child1*>
>>> <Group>group1</Group>
>>> <Code>code1</Code>
>>> <Division>division1</Division>
>>> <Department></Department>
>>> <Class>1512</PSA>
>>> </*child1*>
>>> <*child2*>
>>> <Group>Group2</Group>
>>> <Code>Code2</Code>
>>> <Division></Division>
>>> <Department></Department>
>>> <Class>1010, 1015, 1020</PSA>
>>> </*child2*>
>>> ---
>>> ---
>>> ---
>>> </IDs>
>>>
>>>
>>> I need to write a perl script to capture the values into variables
>>>
>>> I got confused how to handle different childs in Perl .. Child1..Child2
>>>
>>> Any sample perl script will be helpful to me
>>>
>>>
>>> -------------------------------------------
>>>
>>> Regards, J
>>> *$@tya..*
>>>
>>>
>>> _______________________________________________
>>> Bangalore-pm mailing list
>>> Bangalore-pm at pm.org
>>> http://mail.pm.org/mailman/listinfo/bangalore-pm
>>>
>>
>>
>>
>> --
>> ~ Sent from a plain old fashioned device called a komputarrrr ;)
>>
>> _______________________________________________
>> Bangalore-pm mailing list
>> Bangalore-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/bangalore-pm
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.pm.org/pipermail/bangalore-pm/attachments/20131108/d07c6d6a/attachment.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Bangalore-pm mailing list
> Bangalore-pm at pm.org
> http://mail.pm.org/mailman/listinfo/bangalore-pm
>
> ------------------------------
>
> End of Bangalore-pm Digest, Vol 56, Issue 2
> *******************************************
More information about the Bangalore-pm
mailing list