Parsing config-file (perl)

Hi,

i'm trying to parse a config file that have alot of rows similar to this one:

Example value value value

What i want to do is to split and save the row above in a hash, like this:

Example = value value value

Basically i want to split on the first whitespace after the first word/directive.

Thanks!

You can use split to split the lines into lists, see "perldoc -f split". Once you have the list, you can pull the first value off the list with shift, see "perldoc -f shift".

Thanks!

Or use my favourite hammer, regex. Assuming $_ is defined:

/([^ ]*) (.*)/ and $hash{$1} = $2;

man perlre