in reply to Input Output Question

Something a bit like this, perhaps (untested):

#!/usr/bin/perl use strict; use warnings; my $name = shift or die "No name given\n"; while (<>) { if (/name: $name/) { print; print scalar <>; } }

This reads from STDIN and writes to STDOUT. I think that's often more flexible than opening your own filehandles. You can use standard Unix redirection tricks to read from and write to specific files.


See the Copyright notice on my home node.

Perl training courses