Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Howto covert to Hash structure?

Reply
Thread Tools

Howto covert to Hash structure?

 
 
ipellew@pipemedia.co.uk
Guest
Posts: n/a
 
      12-21-2004
Hi all;

Whats the fastest way to convert the likes of:-
it var=`A` list=who;loves;"me"
it list='D|"abc.htm"|Abc dynamite;B|xyz.htm|Here =go' var=C
it var=S list="Multi|S001|S103|Saxsoph
maybe;Mono|S84|S634|Pea=\"green\";|S011|S973|'Info rmix';";
it etc etc

To sumthing like:-
%HoH= {
it0 => {
val => {A1=>'who',
A1=>'loves',
A1=>'me'},
it1 => {
val => {C1=>'D',
C2=>'"abc.htm"',
C3=>'Abc dynamite'},
{C1=>'B',
C2=>'xyz.htm',
C3=>'Here =go'}},
it2 => {
val => {S1=>'Multi',
S2=>'S001',
S3=>'S103',
S4=>'Saxsoph maybe'},
{S1=>'Mono',
S2=>'S84',
S3=>'S634',
S4=>'Pea=green'},
{S1=>'',
S2=>'S011',
S3=>'S973',
S4=>'Informix'}}
it3 => etc
}

The quote variations are me trying to allow sysadmin loose choice of
defining the variables.
My skills are not good enough to get this to work in Perl.
Maybe theres a module that would do it for me?

Regards
Ian

 
Reply With Quote
 
 
 
 
Jim Keenan
Guest
Posts: n/a
 
      12-21-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi all;
>
> Whats the fastest way to convert the likes of:-
> it var=`A` list=who;loves;"me"
> it list='D|"abc.htm"|Abc dynamite;B|xyz.htm|Here =go' var=C
> it var=S list="Multi|S001|S103|Saxsoph
> maybe;Mono|S84|S634|Pea=\"green\";|S011|S973|'Info rmix';";
> it etc etc



> [snip]



> My skills are not good enough to get this to work in Perl.


Then improve your skills by learning to use the documentation supplied
with Perl.

perldoc -f split

perldoc perlvar

perldoc perlreftut

etc.

Jim Keenan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hash of hash of hash of hash in c++ rp C++ 1 11-10-2011 04:45 PM
Hash#select returns an array but Hash#reject returns a hash... Srijayanth Sridhar Ruby 19 07-02-2008 12:49 PM
Covert UTC String to UTC Datetime =?Utf-8?B?aGVuaw==?= ASP .Net 3 05-07-2006 06:25 PM
How to covert String("6,400.0") to Double ? Java 4 07-29-2005 05:48 AM
REQ:trying to covert mpeg to dvd help BIGL DVD Video 1 06-17-2004 04:59 AM



Advertisments