D
David Filmer
I can do this:
chomp($ps = `which ps`); #chomp that system-call linefeed!
%hash = ('key' => $ps);
but what I really want to do is something like this:
%hash = ('key' => chomp `which ps`);
(one command, no intermeditate variable) but Perl hates my syntax (and
the several similar variants I've guessed at, playing with different
parenthesis groupings).
Does anyone know the proper syntax?
PS - I know this works:
chomp($hash{'key'} = `which ps`);
but that's not how I want to declare it for reasons that would bog
down my post. It ought to be possible to do the same thing with
%hash=(key=>value) syntax.
chomp($ps = `which ps`); #chomp that system-call linefeed!
%hash = ('key' => $ps);
but what I really want to do is something like this:
%hash = ('key' => chomp `which ps`);
(one command, no intermeditate variable) but Perl hates my syntax (and
the several similar variants I've guessed at, playing with different
parenthesis groupings).
Does anyone know the proper syntax?
PS - I know this works:
chomp($hash{'key'} = `which ps`);
but that's not how I want to declare it for reasons that would bog
down my post. It ought to be possible to do the same thing with
%hash=(key=>value) syntax.