in reply to inplace edit and END block

The END block is executed outside the loop that -n created. If you had two input files, it would still execute only once. I think this will do what you wanted:
perl -F';' -ani -e 'print "delete from atable where afield = $F[0]\n"; + print "quit\n" if eof' delete.sql
It looks like a reasonable, albeit quick-and-dirty, way to update a table to me.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: inplace edit and END block
by codeacrobat (Chaplain) on Apr 18, 2006 at 19:40 UTC
    I thought in the edited file one could add headers in the CHECK or BEGIN stage and trailers END stage of execution. That would have been a nice feature, hm?
    It prevents checking for $.==1 or eof in every line.

    OT: After experimenting a little with the -i switch I found a nice obfuscated way of deleting files. ;-)
    #!/usr/bin/perl -Xi # usage $0 file_a file_b ... while(<>){}