Re: Help on cleaning strings

2007-08-23 Thread kviel
- Original Message - From: Mário Gamito <[EMAIL PROTECTED]> Date: Wednesday, August 22, 2007 4:18 pm Subject: Help on cleaning strings To: beginners@perl.org > I need to clean all the ocorrences of the "##Z/" string (without > the quotes), from a series of .html files located in a single

Re: Help on cleanining strings

2007-08-23 Thread usenet
On Aug 22, 12:21 pm, [EMAIL PROTECTED] wrote: > I've searche over the web and couldn' find an answer to what I need. The web is not the best place to look. The first place you should look for Perl answers is the perldocs themselves. They are very good. > I need to clean all the ocorrences of th

Re: CGI Help

2007-08-23 Thread usenet
On Aug 21, 8:37 pm, [EMAIL PROTECTED] (Tony Heal) wrote: > I want to run a cgi script from another server inside a local cgi page You could use LWP or (better yet) WWW::Mechanize within your local CGI to fetch the content of the remote page and then display it from your local CGI script. -- The

Re: perl include dependencies?

2007-08-23 Thread Albert Lash
Thank you Chas! I checked that out and found their tutorial which contained a variation on scandeps which can output files as well as modules: scandeps.pl -V -e "use DJabberd.pm" The PAR functionality looks like it will be helpful to for keeping the filesystem tight as well. On 8/22/07, Chas Owe

Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-23 Thread Justin The Cynical
Greets. I have a 'config file' that contains a group name (alphanumeric) and machine name/numbers separated by whitespace. Each group is on it's own line. The file looks like this: prod01 456 345 234 prod02 789 517 325 ...etc, etc, etc... What I am attempting to do is: Put the file contents in

Re: Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-23 Thread lists user
Hi, Rather than a dynamic array,you just need to use a correct datastru,a hash. It's maybe better to write codes as below. [tmp]$ cat groups.txt prod01 456 345 234 prod02 789 517 325 prod03 789 517 325 prod04 789 517 325 prod05 789 517 325 [tmp]$ cat test.pl #!/usr/bin/perl use strict; use warni

Re: File Creator under WIN32 environment

2007-08-23 Thread Rob Dixon
David Wagner wrote: Need to get the individual who created the file I am looking at. I am using File::Find to get all files that are 4 days or younger. I can get all info: Path, file name, file size, date modified easily except owner. I have looked at the Perl doc ( using AS 5.8.8 build

Re: Trying to dynamically create arrays, getting can't use string as ARRAY ref

2007-08-23 Thread Paul Lalli
On Aug 23, 2:00 am, [EMAIL PROTECTED] (Justin The Cynical) wrote: > Add the name of the array to a 'master array' list of the machine > groups > Then create another array, which would be referenced by the group > name, and contains the machines associated with the group. > The script runs if I do

Re: If anyone doesn't mind helping me optimize this code...

2007-08-23 Thread Rob Dixon
John W. Krahn wrote: In perl you almost *never* need to use the eof() function. That is usually written as: while ( read IN, $buffer, $blksize ) { But even that doesn't report any errors that read() may encounter. while ( my $read = read IN, $buffer, $blksize ) { defined $read

just got around to posting this.. (long) SMTP TRACE

2007-08-23 Thread [EMAIL PROTECTED]
Ok..I posted a few weeks ago (ive been so busy at work its not funny) Im using Trouble Tickets express and they want to charge me for troubleshooting but i need to know how to turn on SMTP Trace so I can figure out what my problem is. package TTXMail; use strict; use TTXData; use TTXMarkup; my

Re: entering regular expressions from the keyboard

2007-08-23 Thread Jay Savage
On 8/21/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: > Jeff Pang schreef: > > Christopher Spears: > > >> print "Enter regular expression: "; > >> chomp(my $regexp = ); > > > > $regexp = quotemeta($regexp); > > Since it specifically asks for a regular expression, I would definitely > not do quotemeta(). >

Re: SMTP TRACE

2007-08-23 Thread [EMAIL PROTECTED]
Here's my code sorry its long! its for trouble ticket express package TTXMail; use strict; use TTXData; use TTXMarkup; my $hasb64 = 1; $hasb64 = 0 unless eval "require MIME::Base64"; my $mailer; my $smtphost; my $usesmtp; my $CRLF= "\015\012"; my $doemailfix = 0; #

Re: entering regular expressions from the keyboard

2007-08-23 Thread Jay Savage
On 8/23/07, Jay Savage <[EMAIL PROTECTED]> wrote: > That means the regex is actually being compiled twice. It probably > doesn't, though, make sense to compile the regex before entering the > loop, so perhaps something like: Make that *does* make sense. -- j --

Re: Syntax error?

2007-08-23 Thread Randal L. Schwartz
> ""[EMAIL PROTECTED]" == "[EMAIL PROTECTED] com" <[EMAIL PROTECTED]> > writes: "[EMAIL PROTECTED]> Those three things look like sets (unordered) to me not lists "[EMAIL PROTECTED]> (ordered). The natural datatype in Perl to represent a set of strings "[EMAIL PROTECTED]> is a hash with

Re: just got around to posting this.. (long) SMTP TRACE

2007-08-23 Thread Randal L. Schwartz
> ""[EMAIL PROTECTED]" == "[EMAIL PROTECTED] com" <[EMAIL PROTECTED]> > writes: "[EMAIL PROTECTED]> Im using Trouble Tickets express and they want to charge me for "[EMAIL PROTECTED]> troubleshooting ... so instead, I'll post it here, and try to get free consulting advice from experts,

RE: File Creator under WIN32 environment

2007-08-23 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: Rob Dixon [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 23, 2007 03:38 > To: beginners@perl.org > Cc: Wagner, David --- Senior Programmer Analyst --- WGO > Subject: Re: File Creator under WIN32 environment > > David Wagner wrote: > > > > Need to get t

Problem with @INC in XAMPP

2007-08-23 Thread Andy
I've installed XAMPP on two Windows machinse for Perl CGI development. The configuration on both machines should be the same, but on one any attempt to use the 'require' statement fails with error saying it "Can't Locate" the specified module. On the machine where the script run correctly, the con

Re: If anyone doesn't mind helping me optimize this code...

2007-08-23 Thread John W. Krahn
Rob Dixon wrote: John W. Krahn wrote: In perl you almost *never* need to use the eof() function. That is usually written as: while ( read IN, $buffer, $blksize ) { But even that doesn't report any errors that read() may encounter. while ( my $read = read IN, $buffer, $blksize ) {

Any way to know if a particular file is open and being used ( Windows )

2007-08-23 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Rob Dixon pointed me to a module(Win32::Security::NamedObject) which works, but when I tried a larger volume, it failed with the following: GetNamedSecurityInfo: The process cannot access the file because it is being used by another process. at C:/Perl/site/lib/Win32/Security/NamedObject.p

aggregating time steps

2007-08-23 Thread Kirk Wythers
Sorry for the "not sure where to even begin" nature of this email, but I am stuck. I am trying to put together a aggregating script that takes daily climate data and produces monthly averages. For example, the input file has the form: year month doy tmax tmin par precip NH4

Re: aggregating time steps

2007-08-23 Thread Mr. Shawn H. Corey
Kirk Wythers wrote: Sorry for the "not sure where to even begin" nature of this email, but I am stuck. I am trying to put together a aggregating script that takes daily climate data and produces monthly averages. For example, the input file has the form: ---8<--- snip I need to step through

Re: aggregating time steps

2007-08-23 Thread Chas Owens
On 8/23/07, Kirk Wythers <[EMAIL PROTECTED]> wrote: > Sorry for the "not sure where to even begin" nature of this email, > but I am stuck. I am trying to put together a aggregating script that > takes daily climate data and produces monthly averages. For example, > the input file has the form: > >

Re: Syntax error?

2007-08-23 Thread [EMAIL PROTECTED]
On Aug 23, 4:36 pm, [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > > ""[EMAIL PROTECTED]" == "[EMAIL PROTECTED] com" <[EMAIL PROTECTED]> > > writes: > > "[EMAIL PROTECTED]> Those three things look like sets (unordered) to me not > lists > "[EMAIL PROTECTED]> (ordered). The natural dataty

problems passing values to subroutine using LWP::Useragent

2007-08-23 Thread shadkeene
Hi, I'm back for some advice from you helpful folks. I'm pulling weather data from the web and manipulating it...using airport codes for various weather data, and I use the same subroutine multiple times for various airports. I've had some success passing various airport codes to the other subrouti

Re: If anyone doesn't mind helping me optimize this code...

2007-08-23 Thread eselk
Thanks to all who replied. I figured reading (and writing) one byte at a time was the bottleneck, but mostly I'm not familiar with perl's buffer handling functions/methods... I just knew enough to compare one byte at a time at least (and I guess even that wasn't optimal since I was using "eq" inst

updating totals

2007-08-23 Thread Chris
I'm trying to solve another problem in Intermediate Perl. Here is the problem: The program from Exercise 2 in Chapter 5 needs to read the entire datafile each time it runs. However, the Professor has a new router logfile each day and doesn't want to keep all that data in one giant file that take

Re: just got around to posting this.. (long) SMTP TRACE

2007-08-23 Thread [EMAIL PROTECTED]
#1. I am not a SIR I am a Miss #2 I was told I could post this...im my other post I had said I didn't have any experience with Perl, I didn't have any classes in college and my boss gave me a side project to do. I'm trying to avoid paying 60 dollars an hour for troubleshooting. On Aug 23, 11:40

Re: problems passing values to subroutine using LWP::Useragent

2007-08-23 Thread Tom Phoenix
On 8/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I've had some success passing various airport codes > to the other subroutines using functions like lwp::simple, but in this > one it's not working. Has anyone suggested using higher-level WWW::Mechanize instead of low-level LWP::Simple?

Re: Any way to know if a particular file is open and being used ( Windows )

2007-08-23 Thread Jeff Pang
2007/8/24, Wagner, David --- Senior Programmer Analyst --- WGO <[EMAIL PROTECTED]>: > Rob Dixon pointed me to a module(Win32::Security::NamedObject) > which works, but when I tried a larger volume, it failed with the > following: > > GetNamedSecurityInfo: The process cannot access the file

global substitution with files

2007-08-23 Thread Yoyoyo Yoyoyoyo
Hi all, I have a file that I need to use the substitute operator on to get rid of spaces, and apostrophes and such. The only way I can think of doing it is this: 1. Open the file and go through it one line at a time with the diamond operator. 2. Make the substitutions on the $_ variable and

Re: global substitution with files

2007-08-23 Thread Gunnar Hjalmarsson
Yoyoyo Yoyoyoyo wrote: I have a file that I need to use the substitute operator on to get rid of spaces, and apostrophes and such. The only way I can think of doing it is this: 1. Open the file and go through it one line at a time with the diamond operator. 2. Make the substitutions on the

Fwd: aggregating time steps

2007-08-23 Thread Kirk Wythers
Begin forwarded message: On Aug 23, 2007, at 4:25 PM, Mr. Shawn H. Corey wrote: # How about? my ( $year, $month, $doy, $tmax, $tmin, $par, $precip, $NH4, $NO3, $O3, $CO2, $V1, $V2, $V3, $V4 ) = split; # You can now store your totals by month as: $totals{$year}{$month}{tmax} += $tmax; .

Re: global substitution with files

2007-08-23 Thread Jeff Pang
Use one-liner Perl to do the replacement without calling 'open' and '<>' and 'close' directly. $ perl -pi.bak -e 's/abc/def/' file.txt 2007/8/24, Yoyoyo Yoyoyoyo <[EMAIL PROTECTED]>: > Hi all, > > I have a file that I need to use the substitute operator on to get rid of > spaces, and apostrophes

Re: global substitution with files

2007-08-23 Thread Jeff Pang
2007/8/24, Gunnar Hjalmarsson <[EMAIL PROTECTED]>: > Yoyoyo Yoyoyoyo wrote: > > I have a file that I need to use the substitute operator on to get > > rid of spaces, and apostrophes and such. The only way I can think of > > doing it is this: > > > > 1. Open the file and go through it one line at

Re: updating totals

2007-08-23 Thread Chris
Ok I figured out a solution: #!/usr/bin/perl -w use strict; use Storable; my %total_bytes; my $all = "**all machines**"; my $output_file = 'storage'; if (-e $output_file) { my $hashref = retrieve $output_file; %total_bytes = %$hashref; } else { print "$output_file has not

Re: global substitution with files

2007-08-23 Thread Gunnar Hjalmarsson
Jeff Pang wrote: 2007/8/24, Gunnar Hjalmarsson <[EMAIL PROTECTED]>: Yoyoyo Yoyoyoyo wrote: I have a file that I need to use the substitute operator on to get rid of spaces, and apostrophes and such. The only way I can think of doing it is this: 1. Open the file and go through it one line at

Re: Fwd: aggregating time steps

2007-08-23 Thread Gunnar Hjalmarsson
Kirk Wythers wrote: I don't see how $totals{$year}{$month}{count} ++; is holding the count. Read about the auto-increment operator in "perldoc perlop". -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e

Re: just got around to posting this.. (long) SMTP TRACE

2007-08-23 Thread Chas Owens
On 8/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: snip > my $cfg = TTXData::get('CONFIG'); snip > if ($cfg->get('smtptrace')) { snip > open STDERR, '>>'.$cfg->get('basedir').'/smtptrace.txt'; snip > my $s = Net::SMTP->new($smtphost, Debug => $cfg- > >get('smtptrace') ? 1:0);

manipulating csv file fields through perl

2007-08-23 Thread Mihir Kamdar
Hi, I have a csv file. I wanted to do some calculations on some of its fields, like multiplying the 7th field with the 13th field and overwriting the 13th field with the answer of my calculation. Regarding this, can I do the calculations on the input file and overwrite it after calculating, or I

Re: unfamiliar array reference

2007-08-23 Thread petelink1
On Aug 18, 7:58 pm, [EMAIL PROTECTED] (Paul Lalli) wrote: snip > > Is that seriously from the book? UGH. Just declare $array_ref in the > proper scope, and there's no need to take a reference to a dereference > of the reference. > > while (my $array_ref = $sth1->fetchrow_arrayref) { > push