in reply to Re: String Interpolation on single quote string?
in thread String Interpolation on single quote string?

Thanks for all the help guys, I have had a play and because I want to be able to put a number of different commands in without worrying, and the format is something that I can set myself for the input file I've opted for the file containing any commands, that need to be parsed, within a set of asterisks. The asterisk is not needed anywhere else within the file so I have decided on using the following code:
sub ParseArguments { # Parses any perl commands with * delimeters, eg: + '*$ENV{CONFIG_DIR}*/contents' --> 'MY/CONFIG/DIR/contents' my $Line = pop @_; my @Args = split /\*/, $Line; foreach my $Arg (@Args) { if ($Arg ne "") { if ($Arg =~ /^[\@\$\%]/) { my $Temp; $Arg = "\$Arg = $Arg"; eval $Arg; $Arg =~ s/^\$Arg = //; } } } my $Return = ""; foreach my $Arg (@Args) { $Return = $Return . $Arg; } return $Return; }

The contents of the file can now contain a number of different items that I need, examples are:
*$ENV{COMPANY}*/Custom_Perl/Logs *$Config->{PerlDir}*/Lib/Chris/Pantheon/Border.CoOrds

I know this isn't the best way for me to do this as it leaves all kinds of security vulnerabilities etc, but I'm not worried about those as the program ultimately is run by me and a few other people who don't have any knowledge of perl anyway!
Thanks Again Guys,
Chris Bailey