#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1172179 use strict; use warnings; sub add { 4 * shift; } $_ = '123 - 4 - 75 - 12'; print; s/(\d+)/ add($1) /ge; print;
In reply to Re: String replace with function
by Anonymous Monk
in thread String replace with function
by kepler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |