No appending...

2005-05-18 Thread Wert, Nathaniel J
The following script is not appending to the file for some reason. Please bestow your wisdom on me oh great Perl gods. :-) -- #!/usr/bin/perl -w my $size=0; my @stat; open(TEMPFILE, /temp/temp.big_ass_file) or die unable to

Re: No appending...

2005-05-18 Thread Randal L. Schwartz
Nathaniel == Nathaniel J Wert [EMAIL PROTECTED] writes: Nathaniel The following script is not appending to the file for some reason. Nathaniel Please bestow your wisdom on me oh great Perl gods. :-) Nathaniel Nathaniel --

Re: No appending...

2005-05-18 Thread Chris Devers
On Wed, 18 May 2005, Wert, Nathaniel J wrote: open(TEMPFILE, /temp/temp.big_ass_file) or die unable to write /temp/temp.big_ass_file:$\n; On most Unix systems I've used, the name is usually /tmp, not /temp. If you're trying to work on a file in a nonexistent directory, you probably won't get

RE: No appending...

2005-05-18 Thread Wert, Nathaniel J
I guess I should give a little more in depth explanation. The file and directory does exist. The names are changed to protect the innocent (I did not want to use the tmp dir). This is basically to simulate a large log file having entries written to it every second. This is a section of a

RE: No appending...

2005-05-18 Thread Wert, Nathaniel J
Actually, with the help of another person here we figured out what was wrong. Apparently there is a problem with the sleep() function where it interferes with the open() of the file. We have found three ways of fixing this. system(sleep 1); instead of sleep() or using fopen instead of open. I

Re: No appending...

2005-05-18 Thread Randal L. Schwartz
Nathaniel == Nathaniel J Wert [EMAIL PROTECTED] writes: Nathaniel Actually, with the help of another person here we figured Nathaniel out what was wrong. Apparently there is a problem with the Nathaniel sleep() function where it interferes with the open() of the Nathaniel file. That can't be

RE: No appending...

2005-05-18 Thread Wert, Nathaniel J
Please excuse my lack of knowledge in this subject. The original script executes every statement and in the process, it erases the file when it does the open and then proceeds to not write to the file at all. Is the text that is supposed to be written to the file stored in a buffer while the

Re: No appending...

2005-05-18 Thread Randal L. Schwartz
Wert, == Wert, Nathaniel J [EMAIL PROTECTED] writes: Wert, Please excuse my lack of knowledge in this subject. The original script Wert, executes every statement and in the process, it erases the file when it Wert, does the open and then proceeds to not write to the file at all. Is the Wert,

extracting columns

2005-05-18 Thread Aditi Gupta
Hi everybody, to extract data columnwise from a file, the following code was written with the help of perl experts of this list. the script is as follows: #!usr/bin/perl

Re: columnwise analysis

2005-05-18 Thread Xavier Noria
On May 18, 2005, at 7:55, Aditi Gupta wrote: is guess_alphabet a predefined function in the following code? my @counters = (); while (my $row = $fh) { my @cols = split /\s*-\s*/, $row; for (my $i = 0; $i @cols; ++$i) { my $code = guess_alphabet($cols[$i]);

Re: perl afs module

2005-05-18 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi all Hello, I am trying to learn perl. I am using perl afs module to administer our afs cell. my problem is, the attached script is forking a new process and is not releasing the memory as iam new to programming I am pretty sure i am doing some simple mistake I would

RE: extracting columns

2005-05-18 Thread Ankur Gupta
From: Aditi Gupta [mailto:[EMAIL PROTECTED] Hi everybody, to extract data columnwise from a file, the following code was written with the help of perl experts of this list. the script is as follows: --

Re: extracting columns

2005-05-18 Thread Xavier Noria
On May 18, 2005, at 8:03, Aditi Gupta wrote: for (my $j=0; $j$x; $x++) The last one would surely be $j++. the code isn't giving any errors but it also isn't printing the result as well. Please someone tell me why is this happeining.. Please, next time format your code using standard conventions,

RE: extracting columns

2005-05-18 Thread Thomas Bätzler
Aditi Gupta [EMAIL PROTECTED] wrote: to extract data columnwise from a file, the following code was written with the help of perl experts of this list. the script is as follows: #!usr/bin/perl use warnings; use strict; my %hash; $file= try.txt; open (FH, $file) or die; @rows=FH;

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

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 that

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

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. 1

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:

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

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

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

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

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

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? http://search.cpan.org/~agul/Crypt-GPG-1.52/GPG.pm You could solve this the way you're trying to solve it, but the GPG module is probably going to be easier.

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: 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 Topic/with link/ children are followed by their own ExternalPage/s. If there is a Topic/ without link/ inside, it is followed by a new Topic/. So I think your codes are safe enough to use :-). However,

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, Thanks

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 Topic/with link/ children are followed by their own ExternalPage/s. If there

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

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? http://search.cpan.org/~agul/Crypt-GPG-1.52/GPG.pm This script is to be run from an nfs mount on many systems, so it has to run with the modules

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

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 old to a

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 output

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

Re: square symbol at end of each line

2005-05-18 Thread perlocean
- Original Message - From: [EMAIL PROTECTED] To: beginners@perl.org 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

Re: square symbol at end of each line

2005-05-18 Thread perlocean
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: beginners@perl.org 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

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] mailto:[EMAIL PROTECTED] -CONFIDENTIAL, PRIVILEGED COMMUNICATION- This e-mail transmission is private

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.

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

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

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 sure

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

Re: Baffling unicode wierdness

2005-05-18 Thread Graeme St.Clair
I would throw the sterling sign out of the source document, and substitute pound; or #xa3; or #163; (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:

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 statements (and

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 example, or

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: 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

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 just like to use

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 content type

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 [EMAIL

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 Pinyan

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, snip 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::Simple; my

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? Or

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

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

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 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

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

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: sprintf is now working

2005-05-18 Thread Charles K. Clarkson
[EMAIL PROTECTED] mailto:[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, ( $now - (

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

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