in reply to Parsing variables from login scripts
You could make that shorter, but you could also add better checking to make it better. Jellybean actually does this in Jellybean::Config, so I know I've written it correctly at least once before.while (<INPUT>) { chomp; my ($var, $value) = split(/\s*=\s+/, $_, 2); if ($value =~ s/^\$(\w+)//) { # $value .= $env_var{$1} || ''; $value = $env_var{$1} . $value; } $env_var{$var} = $value; }
Update: Don't work and post. Fastolfe is correct, and I've updated my code to work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Parsing variables from login scripts
by eLore (Hermit) on Jul 28, 2000 at 18:55 UTC | |
by chromatic (Archbishop) on Jul 29, 2000 at 04:15 UTC | |
|
RE: Re: Parsing variables from login scripts
by Fastolfe (Vicar) on Jul 28, 2000 at 19:34 UTC |