You need to apply a regular expression mask from the console. Those. "Type a mask" is written in the console, the mask is printed and symbols are already being replaced.
Here is what is available:
#! /usr/bin/perl print < STDOUT >."Введите маску"; $pattern = < STDIN >; $stroka = " as df as df a sd ff as df asdfasdf asdf"; $stroka=~s/$pattern//g; print $stroka; But it is impossible to apply a mask. What is the problem here?
$lineand where does it come from? Maybe$stroka? And by the way, not$pattern = < STDIN >;, and $ pattern = <STDIN>; and print <STDOUT> I don’t remember how to be fine. And further.$patternwill contain the end of the string, so after $ pattern = <STDIN>; chop $ pattern does not hurt; (althoughchomp $pattern;is betterchomp $pattern;safer) - alexlzuse strict- shooting without the right to rehabilitate :) - user6550