Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-11 Thread budi pearl
Hi Jim, On Fri, Jan 11, 2013 at 1:54 PM, Jim Gibson wrote: > OR > > print_path( $id, $routes->{$id} ); > ... > sub print_path > { > ... > while( my ($start, $end) = each %$edges ) { > > This is what i want, thank you! Apparently passing "$routes->{$id}" is my earlier issue. --budi

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread Jim Gibson
On Jan 10, 2013, at 7:33 PM, budi pearl wrote: > Hi All, > > I would like to pass hash: %{$routes{"ROUTE-252"}} instead of %routes but > got this error: > > [budi@dev bin]$ ./print_path.pl > Type of arg 1 to each must be hash (not hash element) at > ./print_path.plline 38, near "}) " > Executio

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
On Fri, Jan 11, 2013 at 11:05 AM, budi pearl wrote: > Hi Shawn, > > When trying to accessed inside subroutine , i got: > > Type of arg 1 to each must be hash (not hash element) at ./print_path.plline > 41, near "}) " > > Execution of ./print_path.pl aborted due to compilation errors. > > > this

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
Hi Shawn, When trying to accessed inside subroutine , i got: Type of arg 1 to each must be hash (not hash element) at ./print_path.plline 41, near "}) " Execution of ./print_path.pl aborted due to compilation errors. this is work: while (my ($start, $end) = each %{$routes{$label}}) { but thi

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread Shawn H Corey
On Fri, 11 Jan 2013 10:33:02 +0700 budi pearl wrote: > my $id = "ROUTE-252"; > print Dumper $routes{$id}; > > print_path($id, \%{$routes{$id}}); I think you want: print_path( $id, $routes{$id} ); -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubs

Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
Hi All, I would like to pass hash: %{$routes{"ROUTE-252"}} instead of %routes but got this error: [budi@dev bin]$ ./print_path.pl Type of arg 1 to each must be hash (not hash element) at ./print_path.plline 38, near "}) " Execution of ./print_path.pl aborted due to compilation errors. #use

Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
Hi Rob, This works and looks much more simpler. Thanks, i love it. --budhi On Fri, Jan 11, 2013 at 1:00 AM, Rob Dixon wrote: > On 10/01/2013 10:01, budi perl wrote: > >> Hi, >> >> I have this following hash: >> >> #!/usr/bin/perl >> # >> use strict; >> use Data::Dumper; >> >> my %MYROUTES = (

Re: finding head and tail in data structure

2013-01-10 Thread Rob Dixon
On 10/01/2013 10:01, budi perl wrote: Hi, I have this following hash: #!/usr/bin/perl # use strict; use Data::Dumper; my %MYROUTES = ( "ROUTE-252" => { # src => dest 427 => "ABEP", "ABEP" => 441, 441 => 427, 427 => 444, 444 => "MGWQ",

Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
On Thu, Jan 10, 2013 at 5:19 PM, David Precious wrote: > On Thu, 10 Jan 2013 17:01:43 +0700 > budi perl wrote: > You can't have the same hash key twice; you've duplicated 427 there. > > Also, you don't need to quote the left side of a fat comma, so you can > just as easily say e.g. ABEP => 441. >

Re: finding head and tail in data structure

2013-01-10 Thread David Precious
On Thu, 10 Jan 2013 17:01:43 +0700 budi perl wrote: > Hi, > > I have this following hash: > > #!/usr/bin/perl > # > use strict; > use Data::Dumper; > > my %MYROUTES = ( > "ROUTE-252" => { > # src => dest >427 => "ABEP", >"ABEP" => 441, >441 => 427, >427

finding head and tail in data structure

2013-01-10 Thread budi perl
Hi, I have this following hash: #!/usr/bin/perl # use strict; use Data::Dumper; my %MYROUTES = ( "ROUTE-252" => { # src => dest 427 => "ABEP", "ABEP" => 441, 441 => 427, 427 => 444, 444 => "MGWQ", "MGWQ" => "CDEF" }, "ROUTE-432" => {

Re: More on perl like tail

2009-10-24 Thread Harry Putnam
thing like the > following (untested): > > while(1) { > while() { > print; > } > sleep 1; > seek(FILE,0,1); > } > That does look like it might be better... and thanks for the explanation. [...] >> >> use File::Tail; >&

Re: More on perl like tail

2009-10-24 Thread Jim Gibson
At 3:57 PM -0500 10/24/09, Harry Putnam wrote: Sorry about being tricky with what was an older thread. But I suspect that thread died... and no one noticed there was an unaswered question still there. Or no one knew the answer. Shawn C originally suggested I use File::Tail. There was a

More on perl like tail

2009-10-24 Thread Harry Putnam
Sorry about being tricky with what was an older thread. But I suspect that thread died... and no one noticed there was an unaswered question still there. Shawn C originally suggested I use File::Tail. There was a short exchange about why and then I began trying to use File::Tail but haven&#

Re: perl like tail -f

2009-10-22 Thread Harry Putnam
s usually take care of special cases that you > may not be aware of. That makes them the preferred method of solving a > problem. > > In this case, the above code is a kludge. You can tell this because the > program sleeps, rather than waiting on input. When a program does > something

Re: perl like tail -f

2009-10-20 Thread Peter Scott
On Mon, 19 Oct 2009 23:30:30 -0500, Harry Putnam wrote: > Shawn H Corey writes: > >> http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm > > Thanks that looks useful. Is there a reason why I should use that > module as apposed to the kind of code offered in the faq a

Re: perl like tail -f

2009-10-20 Thread Shawn H Corey
Harry Putnam wrote: > Shawn H Corey writes: > >> http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm > > Thanks that looks useful. Is there a reason why I should use that > module as apposed to the kind of code offered in the faq about > tail? (perldoc -q tail)

Re: perl like tail -f

2009-10-19 Thread Harry Putnam
Shawn H Corey writes: > http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm Thanks that looks useful. Is there a reason why I should use that module as apposed to the kind of code offered in the faq about tail? (perldoc -q tail) as suggested by another poster (Jim G). I mean, I&#x

Re: perl like tail -f

2009-10-19 Thread Harry Putnam
Jim Gibson writes: > On 10/19/09 Mon Oct 19, 2009 11:38 AM, "Harry Putnam" > scribbled: > > >> >> I'm not sure what it is about the tail -f command that allows it to >> keep reading over restarts of system logger (on Opensolaris)... but

Re: perl like tail -f

2009-10-19 Thread Jim Gibson
On 10/19/09 Mon Oct 19, 2009 11:38 AM, "Harry Putnam" scribbled: > > I'm not sure what it is about the tail -f command that allows it to > keep reading over restarts of system logger (on Opensolaris)... but > how can I emulate whatever it is.. in perl? > Th

Re: perl like tail -f

2009-10-19 Thread Shawn H Corey
Harry Putnam wrote: > I'm not sure what it is about the tail -f command that allows it to > keep reading over restarts of system logger (on Opensolaris)... but > how can I emulate whatever it is.. in perl? Have you looked at File::Tail http://search.cpan.org/~mgrabnar/File-Tail-

perl like tail -f

2009-10-19 Thread Harry Putnam
at fifo Now restart system logger. Now anything that sys logger produces will be displayed from the cat command. Now restart systemlogger again and cat closes as would a common shell script or awk. However the `tail -f' command will not close... it keeps on reading through rest

Re: display tail of monster file

2009-09-27 Thread Harry Putnam
叶孤城 writes: > 2009/9/27 叶孤城 : >> 2009/9/27 Harry Putnam : >>> Will it make any difference in loading time or cpu resource usage to >>> use the `tail' command like 'qx/tail -n30 $file/' as apposed to something >>> in straight perl like

Re: display tail of monster file

2009-09-26 Thread 叶孤城
2009/9/27 叶孤城 : > 2009/9/27 Harry Putnam : >> Will it make any difference in loading time or cpu resource usage to >> use the `tail' command like 'qx/tail -n30 $file/' as apposed to something >> in straight perl like this example that prints the last 30 lin

Re: display tail of monster file

2009-09-26 Thread 叶孤城
2009/9/27 Harry Putnam : > Will it make any difference in loading time or cpu resource usage to > use the `tail' command like 'qx/tail -n30 $file/' as apposed to something > in straight perl like this example that prints the last 30 lines of $log: > Not absolute that

display tail of monster file

2009-09-26 Thread Harry Putnam
Will it make any difference in loading time or cpu resource usage to use the `tail' command like 'qx/tail -n30 $file/' as apposed to something in straight perl like this example that prints the last 30 lines of $log: #!/usr/local/bin/perl use strict; use warnings;

Re: How to implement "tail -f" using perl in both windows and linux !

2009-03-24 Thread Chas. Owens
On Tue, Mar 24, 2009 at 10:26, Bob McConnell wrote: snip > As a result, installing a new module on the production server is very > expensive. It must go through our code review and QA testing as well as > being repackaged in the correct format for deployment. It is difficult > to justify this expe

RE: How to implement "tail -f" using perl in both windows and linux !

2009-03-24 Thread Bob McConnell
From: Chas. Owens > On Mon, Mar 23, 2009 at 14:16, Amit Saxena wrote: >> Is it possible to implement this without using any external modules from >> CPAN ? > > The FAQ covers this quite nicely (see below). In general you should > use File::Tail[1]. And on UNIX sys

Re: How to implement "tail -f" using perl in both windows and linux !

2009-03-23 Thread Chas. Owens
On Mon, Mar 23, 2009 at 14:16, Amit Saxena wrote: > Is it possible to implement this without using any external modules from > CPAN ? > > Thanks & Regards, > Amit Saxena > The FAQ covers this quite nicely (see below). In general you should use File::Tail[1]. And on UNIX s

Re: [PBML] How to implement "tail -f" using perl in both windows and linux !

2009-03-23 Thread Randal L. Schwartz
> "Amit" == Amit Saxena writes: Amit> Is it possible to implement this without using any external modules from Amit> CPAN ? Is it possible? Yes. Reasonable? No. Please state clearly your confusion about being able to include CPAN modules in your workflow. Hint: none of the reasons you come

How to implement "tail -f" using perl in both windows and linux !

2009-03-23 Thread Amit Saxena
Is it possible to implement this without using any external modules from CPAN ? Thanks & Regards, Amit Saxena

Re: perl head and tail command ?

2008-04-28 Thread Gunnar Hjalmarsson
Rob Dixon wrote: Richard Lee wrote: when you are doing it to filehandle vs array, which consumes more memory? my source file is about 100,000 lines... open my $source, 'tmp/server.txt' or die !$; VS tie my @file, 'Tie::File', '/tmp/server.txt' or die $!; Neither of them use any significant

Re: perl head and tail command ?

2008-04-28 Thread Rob Dixon
and no doing head -1 /tmp/server.txt >>> is not an option since I need to go through some other stuff >>> before i need to issue below command ) >>> >>> and I wanted to do >>> >>> my $top = `head -1 $source` >>> my $bottom = `tail

Re: perl head and tail command ?

2008-04-28 Thread Richard Lee
r stuff before i need to issue below command ) and I wanted to do my $top = `head -1 $source` my $bottom = `tail -1 $source` but I realized I cannot do $source in back tick. so I imagine i can do my $top = chop $source; But what about the $bottom one? The chop() function simply r

Re: perl head and tail command ?

2008-04-28 Thread Rob Dixon
me other stuff > before i need to issue below command ) > > and I wanted to do > > my $top = `head -1 $source` > my $bottom = `tail -1 $source` > > but I realized I cannot do $source in back tick. > > so I imagine i can do > > my $top = chop $source; > &

perl head and tail command ?

2008-04-28 Thread Richard Lee
ommand ) and I wanted to do my $top = `head -1 $source` my $bottom = `tail -1 $source` but I realized I cannot do $source in back tick. so I imagine i can do my $top = chop $source; But what about the $bottom one? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

AW: Problem in opening the file using Tail Module

2007-08-29 Thread Angerstein
rtfm ^^ -Ursprüngliche Nachricht- Von: sivasakthi [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 29. August 2007 13:16 An: beginners perl Betreff: Re: Problem in opening the file using Tail Module > > File::Tail will read only lines that are added to the file after it >

AW: Problem in opening the file using Tail Module

2007-08-29 Thread Angerstein
buffering at all you use syswrite and only write 1 char at a time.) -Ursprüngliche Nachricht- Von: sivasakthi [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 29. August 2007 12:13 An: Jeff Pang Cc: beginners perl Betreff: Re: Problem in opening the file using Tail Module i didn't get your

Re: Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
> > File::Tail will read only lines that are added to the file after it has been > opened. Your program will simply sleep until something new is added. > > Rob when my log file is updated then it works correctly thanks to all for reply

Re: Problem in opening the file using Tail Module

2007-08-29 Thread Mumia W.
; use warnings; use File::Tail; my $file=File::Tail->new("/some/log/file/path"); while (defined(my $line=$file->read)) { print "$line"; } Thanks, Siva It works for me. Maybe you want to change one of the intervals or timeouts for File::Tail. It could b

Re: Problem in opening the file using Tail Module

2007-08-29 Thread Rob Dixon
sivasakthi wrote: I have used the following code to print the log files. but nothing is printed even it doesn't show the warning message, no prompt is returned. what is the mistake in code , could u help me to find the pbm??? #!/usr/bin/perl use strict; use warnings; use File::Tai

Re: Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
>: > > Hi Guys, > > > > I have used the following code to print the log files. but nothing is > > printed even it doesn't show the warning message, no prompt is > > returned. > > what is the mistake in code , could u help me to find the pbm??? > &

Re: AW: Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
>File::Tail is waiting at least 10 second before starting to work. if it is taking at least 10 second to start then how it is faster than using open to access the file??? On Wed, 2007-08-29 at 11:49 +0200, Angerstein wrote: > File::Tail is waiting at least 10 second before starting to work

Re: Problem in opening the file using Tail Module

2007-08-29 Thread Jeff Pang
message, no prompt is > returned. > what is the mistake in code , could u help me to find the pbm??? > > #!/usr/bin/perl > use strict; > use warnings; > > use File::Tail; > my $file=File::Tail->new("/some/log/file/path"); > while (defined(my $line=$file->

Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
Hi Guys, I have used the following code to print the log files. but nothing is printed even it doesn't show the warning message, no prompt is returned. what is the mistake in code , could u help me to find the pbm??? #!/usr/bin/perl use strict; use warnings; use File::Tail; my $file

File::Tail + JavaScript (XmlHttpRequest)

2007-06-08 Thread Steve Finkelstein
thought at first it might make more sense to write the backend part of my script in PHP, but PHP lacks http://search.cpan.org/dist/File-Tail/Tail.pm which I'd like to use for continuous screening of a spool file. I was hoping someone could point me in the correct direction to have Perl prop

Re: monitoring file like tail -f in perl

2006-05-29 Thread Xavier Noria
On May 29, 2006, at 18:19, Ken Foskey wrote: I want to monitor a daemon's logs that updates randomly through the day and night. Is there a way to open the log file and read the new records as they come in the same way as tail -f does? Sure, with File::Tail for example. -- fxn

Re: monitoring file like tail -f in perl

2006-05-29 Thread JupiterHost.Net
Ken Foskey wrote: I want to monitor a daemon's logs that updates randomly through the day and night. Is there a way to open the log file and read the new records as they come in the same way as tail -f does? Sure, look on cpan for File::Tail::App and File::Tail -- To unsubscribe, e

monitoring file like tail -f in perl

2006-05-29 Thread Ken Foskey
I want to monitor a daemon's logs that updates randomly through the day and night. Is there a way to open the log file and read the new records as they come in the same way as tail -f does? Thanks Ken -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: the 'tail' problem

2006-01-14 Thread Jeff Pang
e the symlink get changed at 00:00. -Original Message- >From: "JupiterHost.Net" <[EMAIL PROTECTED]> >Sent: Jan 15, 2006 1:04 AM >To: beginners@perl.org >Subject: Re: the 'tail' problem > > > >Jeff Pang wrote: >> hi,lists, > >Hello

Re: the 'tail' problem

2006-01-14 Thread JupiterHost.Net
nix 'tail -f' command.Part of the code is below: open (TAIL,"tail -f $log|") or die "can't open pipe:$!"; while() { do something... } This script is a daemon script which run permanently.There is no problem when in the same day.But when

Re: the 'tail' problem

2006-01-14 Thread Jeff Pang
I don't know why it can't work for me. I have tested it as following: $ln -s mssvr.log.2006-01-14 mylog $tail --follow=name --retry mylog Now this command output the content of mssvr.log.2006-01-14 correctly. So I continue to excute these commands (open another terminal): $rm -f

Re: the 'tail' problem

2006-01-14 Thread Shawn Corey
Jeff Pang wrote: hi,lists, I have a log file which is a symbol link to the real logfile,shown as following: $ll mssvr.log lrwxrwxrwx1 cmail root 40 Jan 14 00:00 mssvr.log -> /home/cmail/logs/mssvr.log.2006-01-14 I have to access this file in perl script with unix '

Re: the 'tail' problem

2006-01-14 Thread John Doe
ira <[EMAIL PROTECTED]> > >Sent: Jan 14, 2006 7:23 PM > >To: Jeff Pang <[EMAIL PROTECTED]>, beginners@perl.org > >Subject: Re: the 'tail' problem > > > >Jeff, > > > >Maybe all you have to do is make some adjustments to the pipe you'

Re: the 'tail' problem

2006-01-14 Thread Adriano Ferreira
this. I also made a few hasty tests, and if you got hard links rather symbolic ones, it looks like "tail -F" would do the magic without hassle. Cheers, Adriano. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: the 'tail' problem

2006-01-14 Thread Jeff Pang
<[EMAIL PROTECTED]>, beginners@perl.org >Subject: Re: the 'tail' problem > >Jeff, > >Maybe all you have to do is make some adjustments to the pipe you're >opening. Besides the well known "-f" switch, some tail's (like gnu >tail) support "

Re: the 'tail' problem

2006-01-14 Thread Adriano Ferreira
Jeff, Maybe all you have to do is make some adjustments to the pipe you're opening. Besides the well known "-f" switch, some tail's (like gnu tail) support "-F" which means a file is followed by its name and the opening is retried from time to time. From "man

the 'tail' problem

2006-01-14 Thread Jeff Pang
hi,lists, I have a log file which is a symbol link to the real logfile,shown as following: $ll mssvr.log lrwxrwxrwx1 cmail root 40 Jan 14 00:00 mssvr.log -> /home/cmail/logs/mssvr.log.2006-01-14 I have to access this file in perl script with unix 'tail -f' command

Re: Emulate "tail -f" on file

2005-05-20 Thread Wiggins d'Anconia
"Because it's up-side down. Why is that? It makes replies harder to read. Why not? Please don't top-post." - Sherm Pendley, Mac OS X list Tielman Koekemoer (TNE) wrote: > > Thanks all for your input. The File::Tail package works although it > seems to st

RE: Emulate "tail -f" on file

2005-05-20 Thread Tielman Koekemoer \(TNE\)
Thanks all for your input. The File::Tail package works although it seems to stop working once I restart the application writing to the logfile. I've played around with the settings but I'll have to take it up with the author. Thanks again! -Original Message- From: Chris Kni

Re: Emulate "tail -f" on file

2005-05-19 Thread Chris Knipe
On Thu, May 19, 2005 at 11:54:35AM +0530, Ramprasad A Padmanabhan wrote: > use File::Tail; > > > On Thu, 2005-05-19 at 11:37, Tielman Koekemoer (TNE) wrote: > > Hi All, > > > > If I wanted to monitor a file in a way that would emulate "tail -f" >

Re: Emulate "tail -f" on file

2005-05-18 Thread Offer Kaye
On 5/19/05, Tielman Koekemoer (TNE) wrote: > > Hi All, > > If I wanted to monitor a file in a way that would emulate "tail -f" > (in the shell), how would I open the file? > > open(FILE, " filename |"); (?) > > TIA > http://perldoc.pe

Re: Emulate "tail -f" on file

2005-05-18 Thread Ramprasad A Padmanabhan
use File::Tail; On Thu, 2005-05-19 at 11:37, Tielman Koekemoer (TNE) wrote: > Hi All, > > If I wanted to monitor a file in a way that would emulate "tail -f" > (in the shell), how would I open the file? > > open(FILE,

Emulate "tail -f" on file

2005-05-18 Thread Tielman Koekemoer \(TNE\)
Hi All, If I wanted to monitor a file in a way that would emulate "tail -f" (in the shell), how would I open the file? open(FILE, " filename |"); (?) TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http:/

Re: tail -f does not exit

2004-05-19 Thread Claude
ething like the program below. Which actually emulates "tail f-" nicely, since it notices a filename change and exits, on contrary of "tail -f" which has to be killed. Rob> use strict; Rob> use warnings; Rob> use IO::Handle; Rob> autoflush STDOUT; Rob> use Fcntl

Re: tail -f does not exit

2004-05-14 Thread Claude
> "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

Re: tail -f does not exit

2004-05-14 Thread Rob Dixon
the file from a shell command line: > > $ echo "this is a new line" >> junk.txt > > Everything ok, except that I would like to find out from the Perl code > above when junk.txt has been deleted, or renamed. Unfortunately, "tail > -f" does not exit... &

tail -f does not exit

2004-05-14 Thread Claude
k.txt Everything ok, except that I would like to find out from the Perl code above when junk.txt has been deleted, or renamed. Unfortunately, "tail -f" does not exit... Any idea how to do that? -- Claude -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: double-log-tail

2004-01-21 Thread Joel Newkirk
as well as dealing with logfile rotation gracefully. > > > > Any suggestions? > > > > Check out File::Tail on CPAN, particularly the section on 'select' and > the mentioned example script, it should get you close. > > http://search.cpan.org/~mgrabnar/Fil

Re: double-log-tail

2004-01-19 Thread Wiggins d'Anconia
Joel Newkirk wrote: I'm interested in tailing two logs (qmail) simultaneously, and interleaving the data in something approaching chronological sequence, as well as dealing with logfile rotation gracefully. Any suggestions? Check out File::Tail on CPAN, particularly the section on 's

double-log-tail

2004-01-12 Thread Joel Newkirk
I'm interested in tailing two logs (qmail) simultaneously, and interleaving the data in something approaching chronological sequence, as well as dealing with logfile rotation gracefully. Any suggestions? j -- "Not all those who wander are lost." - JRR Tolkien -- To unsubscribe, e-mail: [EMA

Re: Unix ls -lrt | tail -1 in Perl

2003-03-21 Thread John W. Krahn
Sudarshan Raghavan wrote: > > On Fri, 21 Mar 2003, NYIMI Jose (BMB) wrote: > > > > From: Palmer Greg [mailto:[EMAIL PROTECTED] > > > > > > $filename = `ls -ltr|tail -1 $DIRECTORY`; > > > print $filename; > > > > Sorry, i didn'

RE: Unix ls -lrt | tail -1 in Perl

2003-03-21 Thread Sudarshan Raghavan
On Fri, 21 Mar 2003, NYIMI Jose (BMB) wrote: > > -Original Message- > > From: Palmer Greg [mailto:[EMAIL PROTECTED] > > Sent: Thursday, March 20, 2003 4:50 PM > > To: NYIMI Jose (BMB) > > Subject: RE: Unix ls -lrt | tail -1 in Perl > > > > &

RE: Unix ls -lrt | tail -1 in Perl

2003-03-21 Thread NYIMI Jose (BMB)
> -Original Message- > From: Palmer Greg [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 20, 2003 4:50 PM > To: NYIMI Jose (BMB) > Subject: RE: Unix ls -lrt | tail -1 in Perl > > > $filename = `ls -ltr|tail -1 $DIRECTORY`; > print $filename; Sorry, i didn&

RE: Unix ls -lrt | tail -1 in Perl

2003-03-20 Thread Hanson, Rob
03 9:17 AM To: Perl beginners Subject: Re: Unix ls -lrt | tail -1 in Perl On Thu, 20 Mar 2003, NYIMI Jose (BMB) wrote: > Hello, > > How can I do this unix command in Perl ? : ls -lrt | tail -1 > Actually, i would like to get the most recent file from a given directory. my $latest

Re: Unix ls -lrt | tail -1 in Perl

2003-03-20 Thread Sudarshan Raghavan
On Thu, 20 Mar 2003, NYIMI Jose (BMB) wrote: > Hello, > > How can I do this unix command in Perl ? : ls -lrt | tail -1 > Actually, i would like to get the most recent file from a given directory. my $latest = (sort {-M $b <=> -M $a} <$dir/*>)[-1]; or

Unix ls -lrt | tail -1 in Perl

2003-03-20 Thread NYIMI Jose (BMB)
Hello, How can I do this unix command in Perl ? : ls -lrt | tail -1 Actually, i would like to get the most recent file from a given directory. Thanks in advance for your input. José. DISCLAIMER "This e-mail and any attachment thereto may contain information which is confide

RE: How do you code a "tail -f" if you're using Net::Rsh?

2003-01-22 Thread Bob Showalter
Richard Fernandez wrote: > There's a FAQ that deals with coding a "tail -f" if you're logfile is > on the same box as the perl script. > But what if you want to use rsh to tail a file remotely? > > Here's what I have: > --8&

How do you code a "tail -f" if you're using Net::Rsh?

2003-01-22 Thread Richard Fernandez
There's a FAQ that deals with coding a "tail -f" if you're logfile is on the same box as the perl script. But what if you want to use rsh to tail a file remotely? Here's what I have: --8<

Re: tail + count

2003-01-12 Thread Mark Goland
ry to open a file 8 and dump last 9 lines of it. if( $#ARGV != 2){ print " usage.";exit 1;} unless ( -f $ARGV[0] ){ print " bad file name ";exit 1;} $n = $ARGV[1]-1 || 9; - Original Message - From: "Mrtlc" <[EMAIL PROTECTED]> To: <[EMAI

Re: tail + count

2003-01-11 Thread Rob Dixon
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

Re: tail + count

2003-01-11 Thread John W. Krahn
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]) {

tail + count

2003-01-11 Thread Mrtlc
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

Re: Grab last line like `tail'

2002-12-01 Thread Danijel Tasov
Harry Putnam wrote: > Is there a perl equivalent to the unix `tail' command? Where I could > grab the last line from a file without having to read the whole file? There is the module File::ReadBackwards; # perl -MCPAN -e 'install File::ReadBackwards' $ perldoc File::ReadB

Grab last line like `tail'

2002-12-01 Thread Harry Putnam
Is there a perl equivalent to the unix `tail' command? Where I could grab the last line from a file without having to read the whole file? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Tail call optimization

2002-06-05 Thread Jenda Krynicky
ME. In fact , I > sent a friend of mine some code recently that would have been improved > in one place by its use. > > But I still have a question :). As I understand it when tail-call > optimization is done automatically there are two advantages. One is > that the stack doesn&

Re: Tail call optimization

2002-06-03 Thread Tagore Smith
g beast in goto &NAME. In fact , I sent a friend of mine some code recently that would have been improved in one place by its use. But I still have a question :). As I understand it when tail-call optimization is done automatically there are two advantages. One is that the stack doesn't grow

Re: Tail call optimization

2002-06-02 Thread Jenda Krynicky
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: > > &

Tail call optimization

2002-05-28 Thread Tagore Smith
I came across this statement on the web: >Perl ... supports the tail-call optimization (although you have to do it by hand). I was wondering if someone could give me an example of this. I know what tail-call optimization means, and how to write tail-recursive functions, in Lisp- just not s

RE: Better "tail -f"

2002-04-02 Thread Bruno Figueira
D] Subject: Re: Better "tail -f" On Tuesday, April 2, 2002, at 04:30 , Bruno Figueira wrote: > However, if another program removes (all) lines from the file referenced > by > FH, perl looses the trailing (for a undetermined time). How do I improve > this code to understand

RE: Better "tail -f"

2002-04-02 Thread Nikola Janceski
preceed it with this then: do{ sleep 1; } while (not -e $filename); of course... you want a more robust tail.. that will require lots of thought... I don't have enough to spare for this though. I have thought about this problem before and said, "screw it, let the

OOOPSIE on tail -f

2002-04-02 Thread drieux
it is a size thing. if tail opened filename 'file' at size N then process p2 truncates it with p2 > file tail -f file has no output till file is > N it's not an inode thing... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROT

Re: Better "tail -f"

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 07:04 , Nikola Janceski wrote: > open(TAIL, "tail -f $filename |") or die "no tail $! $?\n"; > while(){ print $_; > } > close TAIL; first off it doesn't seem to work - it is just siting there. The problem being th

Re: Better "tail -f"

2002-04-02 Thread drieux
On Tuesday, April 2, 2002, at 04:30 , Bruno Figueira wrote: > However, if another program removes (all) lines from the file referenced > by > FH, perl looses the trailing (for a undetermined time). How do I improve > this code to understand the file was changed? I misread your problem - then r

RE: Better "tail -f"

2002-04-02 Thread Nikola Janceski
what about? open(TAIL, "tail -f $filename |") or die "no tail $! $?\n"; while(){ } close TAIL; > -Original Message- > From: Bruno Figueira [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 9:53 AM > To: [EMAIL PROTECTED] > Cc: [EMA

Re: Better "tail -f"

2002-04-02 Thread Chas Owens
On Tue, 2002-04-02 at 09:23, [EMAIL PROTECTED] wrote: > How about putting a file lock on it? > > That way if someone tries to access it and write to it, it will not work. > One problem with doing this is that POSIX does not require programs to check to see if a file is locked before

RE: Better "tail -f"

2002-04-02 Thread Bruno Figueira
Well, I should not lock it. Actually, my code should be "robust" enough to workaround it and "tail -f" a file that is "reseted" sometimes. Cheers, Bruno -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Terça-feira, 2 de Ab

Re: Better "tail -f"

2002-04-02 Thread jbajin
How about putting a file lock on it? That way if someone tries to access it and write to it, it will not work. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Better "tail -f"

2002-04-02 Thread Bruno Figueira
Hi there, I have got the example of trailing a file from "Perl Cookbook": --- for (;;) { while () { print $_ } sleep 1; seek(FH, 0, 1); } --- However, if another program removes (all) lines from the file referenced by FH, perl looses the trailing (for a undetermined tim

Re: TAIL

2002-03-13 Thread Jim Conner
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

  1   2   >