I'm trying to get a string from a regexp, then pass it to a function I made, to remove special symbols from it and save it (to a file, for example). If that inital string comes with a "\" somewhere whitin, after I pass it trought the function, it disappears. I don't want that. Here is how I do it:
if ($line =~ /blablabla :(.+?): bleblable/){
$my_var = fixn($1);
do_whatever_I_want_with($my_var);
}
Here is the function:
sub fixn($){
my $str = "@_";
$str =~ s/[^a-zA-Z0-9^_\-\\`\.\[\]\{\}~]//g;
chomp $str;
return $str;
}
I have the feeling, that backslashes are lost in
my $str = "@_"; <= that quotes turn them into a escape sequences.
Any idea how to keep the backslashes?