SPUG: hash from string
Peter Dueber
peter at hivnet.fhcrc.org
Wed Jul 12 15:34:42 CDT 2000
Many thanks to all the responses!
After trying all of them (so far) the winner is:
%hash = map /'(.*)'/, split /\n|\s*=\s*/, $x;
by Andrew Sweger
it works _really_ well, thanks again Andy.
Ok, how 'bout this one:
instead of
$x = "
'xyz' = '/export/home'
'adfd' = '/usr/there'
'ddddd = '/someplace/else'
etc";
it has integers on the left side:
$x = "
1='strings with blanks or whatever'
2='another set of words'
etc.
Peter Dueber, Esq.
SCHARP/HIVNET Statistical Center
Fred Hutchinson Cancer Research Center
1100 Fairview Ave N, MW-500
PO Box 19024
Seattle, WA 98109-1024
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For full traffic, use spug-list for LIST ; otherwise use spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list