in reply to how to run system commands
my $text = `cat $file`;
Do you know about perldoc? It's a great tool. It documents every single function in perl; it's a real lifesaver. Type
at a prompt and you'll get all the info you need about system, and how to get the output of a command.perldoc -f system
Just a suggestion:
I'd probably do something like the following:
Use perldoc -f to look up each of the glob, open, die, while, chomp, and close functions.#!/usr/bin/perl -w use strict; my $file; my @files = glob("bin/*.pl"); foreach $file (@files) { open(FILE, $file) || die "Couldn't open $file: $!\n"; while(<FILE>) { chomp $_; print("$_\n"); } close(FILE); }
|
|---|