> "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes:
I got your code running nicely, although I had to make a small change due to
an older Perl (5.004) I am using:
[...]
Rob> You need to close and reopen the file if you want to check for a rename.
Rob> Something like the program below.
Which ac
> "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes:
[...]
Rob> You need to close and reopen the file if you want to check for a
Rob> rename. Something like the program below.
[...]
Tx, Rob, I'll give feedback soon here!
--
Claude
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additi
Claude" <[EMAIL PROTECTED]> wrote:
>
> I am reading continuously a file like this:
>
> open LOG, "junk.txt" or die "Cannot open $file, $!\n";
> while ( my $line = ) {
> print "$line";
> }
>
> While appending lines to the file from a shell command line:
>
> $ echo "this is a new line" >
> if (!$ARGV[0]){
> die("you've forgotten to enter the file name\n");
> }
> if (!$ARGV[1]) {
> $n = 9; # output 10 rows by default
> }
> else {
> $n = $ARGV[1]-1;
> }
what if the user enters, "script.pl 8 " ??? This wil try to open a file 8
and dump last 9 lines of it.
if(
Hi John
"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> @ARGV == 2 and my $n = pop || 10;
>
$n will be undefined if @ARGV != 2. Need something like:
$n = @ARGV == 2 ? pop : 10;
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For ad
Mrtlc wrote:
>
> I wrote the following script as a windows tail + count function,
> but it's too slow if the input is huge, how can it be improved?
>
> if (!$ARGV[0]){
> die("you've forgotten to enter the file name\n");
> }
> if (!$ARGV[1]) {
> $n = 9; # output 10 rows by defaul
From: "Tagore Smith" <[EMAIL PROTECTED]>
> Thanks :). That's great. I don't use goto much, except for a couple of
> very specific situations, so I hadn't read the docs for goto. It
> seems I missed a very interesting beast in goto &NAME. In fact , I
> sent a friend of mine some
Jenda Krynicky wrote:
> I believe they meant "goto &NAME".
> This way perl doesn't create a new record in the call stack every
> time you "call" the _fib().
> As you can see if you comment out the return in fib_() and remove
> the comment from "croak ..." and "use Carp;". (die() with stack
>
From: "Tagore Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject:Tail call optimization
Date sent: Tue, 28 May 2002 23:42:30 -0400
> I came across this statement on the web:
>
> >Perl ... supports the tail-call optimizati
I suggest: File::Tail if you are wanting to something like tail -f, though.
Works like a champ.
- Jim
At 06:09 03.14.2002 +, Jonathan E. Paton wrote:
> > Is there a perl function equivalent to the *nix command
> > 'tail'?
>
>Here is a basic Perl implementation of tail:
>
>#!/usr/bin/perl
> Is there a perl function equivalent to the *nix command
> 'tail'?
Here is a basic Perl implementation of tail:
#!/usr/bin/perl
@a=<>;print@a[-10,-1];
IIRC there is a shorter way to do it, but that'd
mean going back over the FWP mailing list archives.
> I don't mean like, a workaround throug
grep in perl doesn't work exactly same way as grep in *nix. It functions
differently in perl, and has better uses in perl that the *nix's grep can't
do.
perldoc -f grep
> -Original Message-
> From: James Taylor [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 13, 2002 3:06 PM
> To: [EM
12 matches
Mail list logo