Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: Can I force " expansion on a string? Message-ID: <1990Aug23.171506.16602@iwarp.intel.com> Date: 23 Aug 90 17:15:06 GMT References: Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Distribution: comp Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 54 In-Reply-To: jes@mbio.med.upenn.edu (Joe Smith) In article , jes@mbio (Joe Smith) writes: | | Is there function call or idiom to get Perl to do double-quote | expansion on the contents of a string? I'm still a little squeamish | using 'eval...', at least as I understand, it won't do what I want. | | Why, you ask? Well, I wanted to use perl to do some simple macro | processing on information read from a file. If perl would do the | replacement, it would save scanning the lines explicitly in my code. | | A contrived example which (when run) demonstrates the problem: | | #!/bin/sh | echo 'The time is now $TIME' | perl -ne ' | | sub showtime { join("-",@_); } | | $TIME = &showtime(localtime(time)); | | print " | I want this to print | The time is now $TIME, | not | $_";' | | | Any suggestions? | |