Re: cat (.sh) in Perl

2007-04-26 Thread Paul Johnson
On Thu, Apr 26, 2007 at 01:38:02AM +0100, Seanie wrote: As a general rule, if your script contains 'system()' anywhere in it, you've done it wrong. I think this is a little strong. Or a little general. Or something. Sometimes a calling system() is exactly the right thing to do. Sometimes

cat (.sh) in Perl

2007-04-25 Thread yitzle
`cat m.top.html m.mid.html m.arc.html m.bot.html blah` How can this be done without a system call? Here's my first guess: @doc = (); for (qw/m.top.html m.mid.html m.arc.html m.bot.html/) { open $FILE,,$root/$_; my @tmp = $FILE; @doc = (@doc,@tmp); close $FILE; }

Re: cat (.sh) in Perl

2007-04-25 Thread Rob Dixon
yitzle wrote: `cat m.top.html m.mid.html m.arc.html m.bot.html blah` How can this be done without a system call? Here's my first guess: @doc = (); for (qw/m.top.html m.mid.html m.arc.html m.bot.html/) { open $FILE,,$root/$_; my @tmp = $FILE; @doc = (@doc,@tmp); close $FILE; }

Re: cat (.sh) in Perl

2007-04-25 Thread John W. Krahn
yitzle wrote: `cat m.top.html m.mid.html m.arc.html m.bot.html blah` How can this be done without a system call? Here's my first guess: use warnings; use strict; @doc = (); my @doc; for (qw/m.top.html m.mid.html m.arc.html m.bot.html/) { open $FILE,,$root/$_; Where is $root

Re: cat (.sh) in Perl

2007-04-25 Thread Seanie
yitzle wrote: `cat m.top.html m.mid.html m.arc.html m.bot.html blah` How can this be done without a system call? As a general rule, if your script contains 'system()' anywhere in it, you've done it wrong. This is especially true for simple file operations such as the above, and for anything

Re: cat (.sh) in Perl

2007-04-25 Thread John W. Krahn
Seanie wrote: yitzle wrote: `cat m.top.html m.mid.html m.arc.html m.bot.html blah` How can this be done without a system call? As a general rule, if your script contains 'system()' anywhere in it, you've done it wrong. This is especially true for simple file operations such as the above,

Re: cat (.sh) in Perl

2007-04-25 Thread Seanie
John W. Krahn wrote: Your syntax for the open() statements is a bit dodgy too :-) Perl defines the syntax so you must mean something else? :-) As in too much unnecessary typing and commas and such, which don't really add clarity, rather than incorrect You should also include the $! or $^E

Re: cat (.sh) in Perl

2007-04-25 Thread John W. Krahn
Seanie wrote: John W. Krahn wrote: Your syntax for the open() statements is a bit dodgy too :-) Perl defines the syntax so you must mean something else? :-) As in too much unnecessary typing and commas and such, which don't really add clarity, rather than incorrect The OP's open