Your code doesn't compile:
$ perl -cw 1152653.pl Global symbol "$in" requires explicit package name at 1152653.pl line +9. Global symbol "$in" requires explicit package name at 1152653.pl line +11. Missing right curly or square bracket at 1152653.pl line 14, at end of + line syntax error at 1152653.pl line 14, at EOF 1152653.pl had compilation errors.
You'll need to fix the errant opening brace and the scoping of $in.
Update: Here's a working rewrite of your script above:
use strict; use warnings; open my $in, '<', '1.txt' or die "Cannot open 1.txt: $!"; while (my $file = <$in>) { $file =~ s/..![^!]*something.*\.c//; print $file; } close $in;
And here's what happens when I run it:
$ cat 1.txt foo ?!?!?!/pack/something/whatever.cacshdska bar $ perl fixup.pl foo ?!?acshdska bar
In reply to Re^3: special pattern reading
by hippo
in thread special pattern reading
by N0obieMonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |