#!/usr/bin/perl # http://perlmonks.org/?node_id=1172192 use strict; use warnings; while(<DATA>) { print; s/(nr\d+)(?{"calc($1);"}) | (\d+)(?{4 * $2}) /$^R/gx; print; } __DATA__ hello nr34,nr56,78, 98 , hi, 76
In reply to Re: String substitution
by Anonymous Monk
in thread String substitution
by kepler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |