That did it. Thanks Rob! --- Rob Dixon <[EMAIL PROTECTED]> wrote: > Navid M. wrote: > > Hello, > > > > I was wondering how you can evaluate parts of a > > string: > > > > Ex: $fileName = "File"; > > $var = '1>>$fileName'; > > > > Now I would like a *simple* way of evaluating $var > > such that only '$fileName' gets substituted for > its > > value. 'eval' doesn't work since it tries to > evaluate > > the whole thing and '1>>' doesn't evaluate to > > anything. > > Eval will work if you give it a valid expression to > evaluate. > As you say, > > 1>>$fileName > > isn't valid Perl, but > > qq(1>>$fileName) > > is, and is what you want. To pass this as string, > you can do this: > > $fileName = "File"; > $var = '1>>$fileName'; > > $var = eval qq("$var"); > print $var, "\n"; > > output: > > 1>>File > > > HTH, > > Rob > > > > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] >
______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]