in reply to Re^3: problem with deleting a row
in thread problem with deleting a row
print $out_fh grep !/^$user,/, <$in_fh>;
As far as I can say, this does not work properly. Using the example under the Perl debugger I gave above in this post Re^5: problem with deleting a row, I obtain the following with your syntax:
This apparently does not work because $user is interpreted literally as a pattern. As I said in the post mentioned above, you need to force evaluation of $user into the content of the variable (I gave in that post two possible ways of doing that) to get this to work properly.DB<3> $user = "foo"; DB<10> print join " ", grep !/^$user,/, qw /foo foobar bar barfoo fo +bar foobaz /; foo foobar bar barfoo fobar foobaz DB<11> print join " ", grep /^$user,/, qw /foo foobar bar barfoo fob +ar foobaz /; DB<12>
|
|---|