Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!ncar!midway!msuinfo!netnews.upenn.edu!jes From: jes@mbio.med.upenn.edu (Joe Smith) Newsgroups: comp.lang.perl Subject: Can I force " expansion on a string? Message-ID: Date: 22 Aug 90 21:43:45 GMT Sender: news@netnews.upenn.edu Distribution: comp Organization: University of Pennsylvania, Philadelphia, PA Lines: 33 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?