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.
In reply to Re: Input Output Question
by davorg
in thread Input Output Question
by coco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |