in reply to Re: Changing -> to work within a string
in thread Changing -> to work within a string

Well, Thanks everybody.
It seems that using tie is the right direction.
But now I will make it harder...
The same $machine object does not only have attributes I can use, it also has methods I can execute.
$machine->shell("ls " . $machine->work_dir);
Will execute the "ls" on the work directory. Using the tie I would want to write
$machine->shell("ls $machine{work_dir}");
The problem is - I actually have two variables - an object $machine, and a hash %machine. But the user don't know it, and I want the user to be able to wrap this line like this:
sub do_ls { my $machine = shift; $machine->shell("ls $machine{work_dir}"); }
If the user will need to do double shift, it will ruin the whole idea.
Any ideas ?
TIA,
shushu TIA, shushu