On Sunday, July 7, 2002, at 07:45 , David Carpenter wrote:
> I have a text file with occasional strings enclosed in braces: > kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . . > > I would like to use tr/// to modify the characters within the braces, > while > leaving the rest of the file unchanged. Whlie I'm sure this is a staight > forward procedure, I've tried a number of loops and can't get it to work. > If anyone could point a beginner in the right direction, he'd appreciate > it. the question here is whether 'the stuff between the curlies' is all the same, or different.... assume we open the file with file handle FH then you could do some sort of loop while(<FH>) { next unless /^(.*)\{([^\}]+)\}.*$/; # # we now have the stuff between the curlies # set into $2, with the stuff before in $1, and # everything after them in $3 my ($pre_stuff, $curly_stuff, $post_stuff) = ($1,$2,$3); } what you may wish to investigate are 'regular expressions'... HTH ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]