in reply to regexps and hashes
or if you need to save them for later use:while (<FILEDATA>) { /$TTITLE(\d+)=(.+)$/ and print "$1-$2\n"; }
while (<FILEDATA>) { /$TTITLE(\d+)=(.+)$/ and push(@titles, "$1=$2\n"); } ## Then just: print @titles;
These ways also allow more than one TTITLE of the same number to exist, if that's a factor. A hash will only save the value of the last one read.
|
|---|