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.perl.org/perlfaq5.html#How-do-I-do-a-tail--f-in-perl- -- O

Re: XML

2005-05-18 Thread Offer Kaye
On 5/19/05, Scott Taylor wrote: > > ... to pump out lines of data to my SQL statement. > > I'll need to end up with something like: > qw($vid,$eid,$event,$desc > ,$date,$mid_desc,$mid_val > ,$pid_desc,$pid_val,$min,$max,$val) > > for each line of data. (or whatever works) > > I think I'm ju

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, " filename |"); (?) > > TIA -

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]

Questions on Perl Syntax from queue.pm

2005-05-18 Thread Siegfried Heintze
I apologize if this appears twice. I posted it once and did not see it appear (after waiting a few hours) in the list so I'm posting it again. I'm looking at the source code for queue.pm and I'm quite surprised at how short it is. I have some questions about the syntax: (1) What does this

Re: sprintf is now working

2005-05-18 Thread Jean-Sébastien Guay
Hi Derek, sprintf ("%.03f",($now - (stat("${hdir}${file}"))[9])/86400); sprintf prints to a string, so you need to assign its return value to something... or print it... or simply switch to printf. my $value = sprintf( ... ); print $value; or print sprintf( ... ); or printf( ... ); Damn

RE: sprintf is now working

2005-05-18 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : I am getting this error, can anyone help? : : sprintf ("%.03f",($now - (stat("${hdir}${file}"))[9])/86400); Use either of these: print sprintf "%.03f", ( $now - ( stat( "${hdir}${file}" ) )[9] ) / 86400; printf "%.03f", (

sprintf is now working

2005-05-18 Thread DBSMITH
I am getting this error, can anyone help? thanks derek # perl -c dir.pl Useless use of sprintf in void context at dir.pl line 29. dir.pl syntax OK #!/usr/bin/perl use strict; use warnings; use Time::localtime; $ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log); my $hdir

Re: Perl syntax questions from source code in queue.pm

2005-05-18 Thread John W. Krahn
Siegfried Heintze wrote: I'm looking at the source code for queue.pm Perl is case sensitive so that should be Queue.pm. and I'm quite surprised at how short it is. I have some questions about the syntax. (1) What does this colon (": shared") mean on line 69? I have not seen a colon used like t

Re: Removing multiple spaces

2005-05-18 Thread John W. Krahn
Jeff 'japhy' Pinyan wrote: On May 18, Dale said: I thought that I could remove lines from the data by matching whether the first character was a letter by using the 'if' statement as : if(substr($line,0,1) eq [a-zA-Z]) ...but this doesn't work. Neither does : if($line eq [\s\d]) ...to try and fi

Perl syntax questions from source code in queue.pm

2005-05-18 Thread Siegfried Heintze
I'm looking at the source code for queue.pm and I'm quite surprised at how short it is. I have some questions about the syntax. (1) What does this colon (": shared") mean on line 69? I have not seen a colon used like this before. 67 sub new { 68 my $class = shift; 69 my

Re: Removing multiple spaces

2005-05-18 Thread Dale
Hi Jeff 'japhy' Pinyan, you wrote: On May 18, Dale said: Hi John W. Krahn, you wrote: If I understand you correctly then this will do what you want: $str =~ tr/ //s; Or if you want a slower method: $str =~ s/ +/ /g; This might sound a strange question, but why is the first one faster? The first one

Re: Removing multiple spaces

2005-05-18 Thread Jeff 'japhy' Pinyan
On May 18, Dale said: Hi John W. Krahn, you wrote: If I understand you correctly then this will do what you want: $str =~ tr/ //s; Or if you want a slower method: $str =~ s/ +/ /g; This might sound a strange question, but why is the first one faster? The first one is not a regex, it's merely a char

Re: Removing multiple spaces

2005-05-18 Thread Dale
Hi John W. Krahn, you wrote: Thanks for taking the time for this detailed explanation! >If I understand you correctly then this will do what you want: > >$str =~ tr/ //s; > >Or if you want a slower method: > >$str =~ s/ +/ /g; This might sound a strange question, but why is the first one faster?

Re: XML

2005-05-18 Thread Scott Taylor
Wiggins d'Anconia said: > Scott Taylor wrote: >> Hello, >> >> I have an XML file that I need to import to a database, >> >> What module should I use for something simple like the following data? > > I would start with XML::Simple until you need more. > > use XML::Simple; > > my $xs = new XML::Sim

Re: One liner to process stdin/stdout similar "in place edit", grep, cut and awk ($5 PayPal reward for the best answer!)

2005-05-18 Thread Jeff 'japhy' Pinyan
On May 18, Lance Murray said: perl -i -p -e "s/oldhostname/newhostname/g" /etc/hosts However, what is the syntax if I wanted to just process a text stream to stdout?, e.g.: cat /etc/hosts | perl "s/in_text/out_text/g" Simple: use the -p and -e switches, but not the -i switch. -- Jeff "japhy" Pin

Re: Where can I find the Token-Definition for Perl

2005-05-18 Thread AOutaspace
Now I have. But what I am searching for, is the definition of the tokens in a Perl File, like WORD, THING and so on, as used in perly.y . Didnt find anything like this in the files you had pointed me to. - Original Message - From: "Chris Devers" <[EMAIL PROTECTED]> To: "Andre Muench" <[EMA

Re: Baffling unicode wierdness

2005-05-18 Thread Jay Savage
On 5/18/05, angie ahl <[EMAIL PROTECTED]> wrote: > I can confirm that it's happening before the data's gone to the > database or anything. > > I'm getting the params from CGI.pm and then decoding via decode("utf8", $v) > > The page the params came from is set as utf-8 in the http header and > con

Re: One liner to process stdin/stdout similar "in place edit", grep, cut and awk ($5 PayPal reward for the best answer!)

2005-05-18 Thread Jay Savage
On 5/18/05, Chris Devers <[EMAIL PROTECTED]> wrote: > On Wed, 18 May 2005, Lance Murray wrote: > > > However, what is the syntax if I wanted to just process a text stream > > to stdout?, e.g.: > > > > cat /etc/hosts | perl "s/in_text/out_text/g" > > > > I'm sure the answer is fairly simple. I'd j

Re: One liner to process stdin/stdout similar "in place edit", grep, cut and awk ($5 PayPal reward for the best answer!)

2005-05-18 Thread John W. Krahn
Lance Murray wrote: Hello: Hello, I've long used Perl's "in place edit" feature, and understand it and regex fairly well, e.g.: perl -i -p -e "s/oldhostname/newhostname/g" /etc/hosts However, what is the syntax if I wanted to just process a text stream to stdout?, e.g.: cat /etc/hosts | perl "s/in_

Re: Baffling unicode wierdness

2005-05-18 Thread angie ahl
I can confirm that it's happening before the data's gone to the database or anything. I'm getting the params from CGI.pm and then decoding via decode("utf8", $v) The page the params came from is set as utf-8 in the http header and content type and firefox is believing the page is utf-8. It looks

Re: XML

2005-05-18 Thread Wiggins d'Anconia
Scott Taylor wrote: > Hello, > > I have an XML file that I need to import to a database, however, searching > CPAN for XML brings up a lot of stuff. I don't know what I need to know. > :( > > What module should I use for something simple like the following data? > > Can someone provide an examp

Re: One liner to process stdin/stdout similar "in place edit", grep, cut and awk ($5 PayPal reward for the best answer!)

2005-05-18 Thread Chris Devers
On Wed, 18 May 2005, Lance Murray wrote: > However, what is the syntax if I wanted to just process a text stream > to stdout?, e.g.: > > cat /etc/hosts | perl "s/in_text/out_text/g" > > I'm sure the answer is fairly simple. I'd just like to use perl one > liners in place of awk, cut, grep stateme

Re: Baffling unicode wierdness

2005-05-18 Thread Graeme St.Clair
I would throw the sterling sign out of the source document, and substitute £ or £ or £ (semi-colon is important!). I think that would probably work across all platforms and browsers. HTH, rgds, GStC. - Original Message - From: "angie ahl" <[EMAIL PROTECTED]> To: ; Sent: Wednesday, May

XML

2005-05-18 Thread Scott Taylor
Hello, I have an XML file that I need to import to a database, however, searching CPAN for XML brings up a lot of stuff. I don't know what I need to know. :( What module should I use for something simple like the following data? Can someone provide an example, or direct me to some good docs wi

One liner to process stdin/stdout similar "in place edit", grep, cut and awk ($5 PayPal reward for the best answer!)

2005-05-18 Thread Lance Murray
Hello: I've long used Perl's "in place edit" feature, and understand it and regex fairly well, e.g.: perl -i -p -e "s/oldhostname/newhostname/g" /etc/hosts However, what is the syntax if I wanted to just process a text stream to stdout?, e.g.: cat /etc/hosts | perl "s/in_text/out_text/g" I'm

Re: passing variables

2005-05-18 Thread JupiterHost.Net
DiGregorio, Dave wrote: Is there a way to pass variables from a perl script to know when it ends to VB? Same way you pass a kidney stone ;) Sorry I couldn't resist ;p Seriously though what have you tried? how is Perl communicating with VB? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

RE: timestamp conversion

2005-05-18 Thread DBSMITH
ok here is what I did: I took (now in seconds - last MTime ) = seconds old seconds old / ( 60x60x24) the divisor gives me in days how old the file is. Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams

Baffling unicode wierdness

2005-05-18 Thread angie ahl
Hi List I've been pottering away trying to get utf-8 behaving on my set up and have nearly got there but then the client phoned up saying that the £ symbol was being displayed as a ? The first page contains several languages and a £ sign and all is displayed fine. http://perl.wtsbroadcast.com/ab

passing variables

2005-05-18 Thread DiGregorio, Dave
Is there a way to pass variables from a perl script to know when it ends to VB? David R. DiGregorio Vocollect 703 Rodi Road Pittsburgh, PA 15235 P. 412-349-2440 [EMAIL PROTECTED] -CONFIDENTIAL, PRIVILEGED COMMUNICATION- This e-mail transmission is privat

Re: square symbol at end of each line

2005-05-18 Thread perlocean
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Wednesday, May 18, 2005 1:13 PM Subject: Re: square symbol at end of each line - Original Message - From: [EMAIL PROTECTED] Date: Wednesday, May 18, 2005 2:05 pm Subject: square symbol at end of ea

Re: square symbol at end of each line

2005-05-18 Thread perlocean
- Original Message - From: <[EMAIL PROTECTED]> To: Sent: Wednesday, May 18, 2005 1:17 PM Subject: RE: square symbol at end of each line The square symbol likely represents a carriage return. Windows and Unix do not like each other's carriage returns and sometimes when you cross informat

RE: square symbol at end of each line

2005-05-18 Thread brian . barto
The square symbol likely represents a carriage return. Windows and Unix do not like each other's carriage returns and sometimes when you cross information from one platform to another you get this funny square. You can get rid if it by: s/\015//; or substitute it with a newline character s/\015/

Re: square symbol at end of each line

2005-05-18 Thread mgoland
- Original Message - From: [EMAIL PROTECTED] Date: Wednesday, May 18, 2005 2:05 pm Subject: square symbol at end of each line > Hi, Hello > I have perl/tk application, where it fetches the data over the > internet and > displays it in a ROText widget. > Everything works but in the outpu

Re: timestamp conversion

2005-05-18 Thread Peter_Farrar
>My goal is to get element 9 of stat which is mtime. I am getting this with >ease, but my end goal is to convert this number back into a readable format >giving me how old the file is. > >So here is a rough draft formula : (time in seconds - last MTime ) = >seconds old. > >Convert seconds o

square symbol at end of each line

2005-05-18 Thread perlocean
Hi, I have perl/tk application, where it fetches the data over the internet and displays it in a ROText widget. Everything works but in the output there is a square *like* symbol printed at the end of each line too. I can not copy and paste the symbol either. I donot understand if it is a perl or t

Re: passing input to an external programs shell

2005-05-18 Thread D. J. Birkett
Chris Devers wrote: On Wed, 18 May 2005, D. J. Birkett wrote: I'm trying to call gpg externally Why? Can't you just use something like Crypt::GPG? This script is to be run from an nfs mount on many systems, so it has to run with the module

installing modules under Windows

2005-05-18 Thread Octavian Rasnita
Hi, If I run ActivePerl under Windows 2000, could I face problems if I install modules using both ppm and cpan and compiling the tar balls? Could there be any binary incompatibilities? Thanks. Teddy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

Re: Errors on processing 2GB XML file by using XML:Simple

2005-05-18 Thread Peter Rabbitson
> I know the answer of second question after reading a quick reference of > twig... You know the answer to your first question as well - you've been looking at it the whole day :) > >I have examined the XML file and all with children are > >followed by their own s. If there is a without > >

Re: Errors on processing 2GB XML file by using XML:Simple

2005-05-18 Thread Nan Jiang
Sorry Peter, I know the answer of second question after reading a quick reference of twig... Nan From: "Nan Jiang" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED], beginners@perl.org Subject: Re: Errors on processing 2GB XML file by using XML:Simple Date: Wed, 18 May 2005 13:44:22 + Hi Peter, Thank

Re: Errors on processing 2GB XML file by using XML:Simple

2005-05-18 Thread Nan Jiang
Hi Peter, Thanks for your patient and detailed answers. I have examined the XML file and all with children are followed by their own s. If there is a without inside, it is followed by a new . So I think your codes are safe enough to use :-). However, where I'm stuck in is, after putting some

RE: timestamp conversion

2005-05-18 Thread DBSMITH
Charles and the Perl beginners, thx for the response. But how do I ,from below, convert seconds old to a date? >From my docs Mtime shows me a timestamp of when the file was last changed. Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams

Re: passing input to an external programs shell

2005-05-18 Thread Chris Devers
On Wed, 18 May 2005, D. J. Birkett wrote: > I'm trying to call gpg externally Why? Can't you just use something like Crypt::GPG? You could solve this the way you're trying to solve it, but the GPG module is probably going to be easier. H

Re: Where can I find the Token-Definition for Perl

2005-05-18 Thread Chris Devers
On Wed, 18 May 2005, Andre Muench wrote: > I'm searching the Perl Sourcecode for the description of the Tokens, > that the yacc Grammar file (perly.y) use. I found only a file with the > parser-code for the lexer. Does anyone know where I can find the > Regular Expressions ? Did you not look at r

Where can I find the Token-Definition for Perl

2005-05-18 Thread Andre Muench
Hi, I'm searching the Perl Sourcecode for the description of the Tokens, that the yacc Grammar file (perly.y) use. I found only a file with the parser-code for the lexer. Does anyone know where I can find the Regular Expressions ? Thanks, Andre

passing input to an external programs shell

2005-05-18 Thread D. J. Birkett
Hi, I'm trying to call gpg externally as part of a small script to import a key and then trust it. It seems that to trust a key, once I've imported it, I must enter the gpg interactive shell. Is there a way to pass commands to this external shell, and then return to my script once it's been d

digging into the perl Mime::Entity modules....

2005-05-18 Thread Manish Sapariya
While using MIME::Entity smtpsend method I ran across some problem and wanted to add some debug messages in the module code. To my surprise the smtpsend() subroutine in the Internet.pm never gets called by the perl code. However subrouting in following ./lib/perl5/site_perl/5.8.5/auto/Mail/Inter

Re: is there be better way to write regex for

2005-05-18 Thread Manish Sapariya
Hi Ing, example u gave compiles well and after diffing your and my code it shows that the single quotes in my $ip = '((?:\d{1,3}\.){3}\d{1,3})' made the code compile. Thanks for the help. Regards, Manish On 05/18/2005 02:49 PM, Ing. Branislav Gerzo wrote: Manish Sapariya [MS], on Wednesday, May

Re: is there be better way to write regex for

2005-05-18 Thread Ing. Branislav Gerzo
Manish Sapariya [MS], on Wednesday, May 18, 2005 at 11:12 (+0530) typed: MS> Thats really neat way of writing the expression I was looking for. MS> But somehow I couldnt get the following compiled. It says heh, ok, this will work: #!/usr/bin/perl use strict; use warnings; my $a="1: 192.168.0.18

Re: is there be better way to write regex for

2005-05-18 Thread Manish Sapariya
I guess I am running into all sorts of problem with this program. Can any body please explain me the compilation error... syntax error at ./a.pl line 11, near "#if($a =~ /((?:" (Might be a runaway multi-line ?? string starting on line 8) Execution of ./a.pl aborted due to compilation errors.

Re: is there be better way to write regex for

2005-05-18 Thread Manish Sapariya
Hi, Thats really neat way of writing the expression I was looking for. But somehow I couldnt get the following compiled. It says Search pattern not terminated at ./a.pl line 8 1 #!/usr/bin/perl 2 3 use warnings; 4 use strict; 5 6 7 my $a="1: 192.168.0.180:32866

Re: is there be better way to write regex for

2005-05-18 Thread Manish Sapariya
Hi, Thats really neat way of writing the expression I was looking for. But somehow I couldnt get the following compiled. It says Search pattern not terminated at ./a.pl line 8 1 #!/usr/bin/perl 2 3 use warnings; 4 use strict; 5 6 7 my $a="1: 192.168.0.180:32866

html2plaintext

2005-05-18 Thread Billy Yiu
Hi all, I am looking for a module helping me to format html to plaintext. I searched in the web and find 2 seems related: 1. HTML::FormatText - Format HTML as plaintext 2. html2text-0.003 But it stated that "Formatting of HTML tables and forms is not implemented.". Do you have any suggestions tha

Re: extracting columns

2005-05-18 Thread Aditi Gupta
Thanks eveybody.. Knowing how to debug programs will always help. And i'm sorry for not formatting the program according to standard conventions.. i'll do that in future. thanks Thomas for the help:-) On 5/18/05, Ankur Gupta <[EMAIL PROTECTED]> wrote: > > From: Aditi Gupta [mailto:[EMAIL PROTE