Re: Sending special chars in email header

2008-05-21 Thread Jeff Peng
On Thu, May 22, 2008 at 1:08 PM, Octavian Rasnita <[EMAIL PROTECTED]> wrote: > Hi Jeff, > > Thank you! My program works fine now. > > Do you know if I need to also encode the subject of the message (because it > is a header also)? Yes you should. Otherwise your messages will have the possibility

Re: Sending special chars in email header

2008-05-21 Thread Octavian Rasnita
Hi Jeff, Thank you! My program works fine now. Do you know if I need to also encode the subject of the message (because it is a header also)? I've seen that even if I don't encode the subject, it shows fine in Outlook Express, but I don't know what the specifications say, so I don't know if it

Re: Comparing file contents, the perl way

2008-05-21 Thread Li, Jialin
On Wed, May 21, 2008 at 9:40 PM, beast <[EMAIL PROTECTED]> wrote: > Good morning, > > I have 2 files which contains some IDs. Basically I want to search ID > in the file A which is missing on the file B. > > This program is ugly, but its work :-) > > use strict; > > my $target_file =

Comparing file contents, the perl way

2008-05-21 Thread beast
Good morning, I have 2 files which contains some IDs. Basically I want to search ID in the file A which is missing on the file B. This program is ugly, but its work :-) use strict; my $target_file = "B.txt"; while(<>) { chomp; my $res = `grep $_ $target_file`; print "$_ is

Re: How do I find the key of a specific hash element?

2008-05-21 Thread Rob Dixon
jshock wrote: > On May 19, 9:05 pm, [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > >> This seems like it should be an array, not a hash. Just FYI. > > I used a hash because I wanted to loop through them in sequence. I > thought I read somewhere that arrays are not automatically sorted. I think

Re: DBI question

2008-05-21 Thread Rob Dixon
Ken Foskey wrote: > On Wed, 2008-05-21 at 23:53 +1000, Ken Foskey wrote: >> I have a program that will run literally for days and days. It monitors >> logs by file tail. Problem is that I think the DBI is causing problems. >> It is constantly connecting and reconnecting to DB2 for every >> transa

Re: DBI question

2008-05-21 Thread Ken Foskey
On Wed, 2008-05-21 at 23:53 +1000, Ken Foskey wrote: > I have a program that will run literally for days and days. It monitors > logs by file tail. Problem is that I think the DBI is causing problems. > It is constantly connecting and reconnecting to DB2 for every > transaction. The original did

Re: How do I find the key of a specific hash element?

2008-05-21 Thread jshock
On May 19, 9:05 pm, [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > This seems like it should be an array, not a hash. Just FYI. I used a hash because I wanted to loop through them in sequence. I thought I read somewhere that arrays are not automatically sorted. I am building a calendar generat

Re: How to chdir using SFTP or SSH on Win32

2008-05-21 Thread Rob Dixon
Sturdevant, Robert W Mr CTR USA AMC wrote: > > Yeah, I got all that but unfortunately I need a workaround due to a coding > error on the server end. The server-end SFTP logic is a rewrite of an > earlier FTP app that still expects a CD before the GET. Any ideas? Magic? Are you sure this isn't ord

Re: How to chdir using SFTP or SSH on Win32

2008-05-21 Thread Rob Dixon
Sturdevant, Robert W Mr CTR USA AMC wrote: > > Yeah, I got all that but unfortunately I need a workaround due to a coding > error on the server end. The server-end SFTP logic is a rewrite of an > earlier FTP app that still expects a CD before the GET. Any ideas? Magic? There is no cd command in S

Re: Multiline comment in Perl

2008-05-21 Thread Octavian Rasnita
From: "Dr.Ruud" <[EMAIL PROTECTED]> Variant: sub half { return unless defined $_[0]; return $_[0] / 2; q/* Returns $val divided by 2 */ } q/* This is a multi- line comment. */ if 0; -- Affijn, Ruud Another va

RE: How to chdir using SFTP or SSH on Win32

2008-05-21 Thread Sturdevant, Robert W Mr CTR USA AMC
Hi Rob, Yeah, I got all that but unfortunately I need a workaround due to a coding error on the server end. The server-end SFTP logic is a rewrite of an earlier FTP app that still expects a CD before the GET. Any ideas? Magic? Thanks, Sturdy -Original Message- From: Rob Dixon [mailto:[

Re: Multiline comment in Perl

2008-05-21 Thread Dr.Ruud
Paul Johnson schreef: > sub half > { > my ($val) = @_; > $val / 2; > q/ > Returns $val divided by 2 > /; > } Variant: sub half { return unless defined $_[0]; return $_[0] / 2; q/* Returns

Re: scaling text

2008-05-21 Thread R. Hicks
zentara wrote: On Mon, 19 May 2008 14:37:27 -0400, [EMAIL PROTECTED] (Robert L Hicks) wrote: Is there an algorithm to scale text on a graphic? I have a badge 200x200 that I would like to scale text on. I have looked at a bunch of Perl image libraries ( o_O ) but I didn't see an example. Ro

Re: How to chdir using SFTP or SSH on Win32

2008-05-21 Thread Rob Dixon
Sturdevant, Robert W Mr CTR USA AMC wrote: > Hi list, > > I asked this question a few days ago on the perl-win32-users list but > still need some help. It seems what I need may not be possible. > > I have a perl (5.6) SFTP client (Net::SFTP) that gets and puts files > using either a full or relat

Re: what is ^M at the end of a line?

2008-05-21 Thread Rob Dixon
Remy Guo wrote: > hi all, > i have a text processing script that can work with a file but cannot work > with another file that has the same content. > as i compared the 2 files, i found the file that cannot work has a "^M" at > the end of each line. what is this? is this what made it not work? > by

Re: what is ^M at the end of a line?

2008-05-21 Thread Remy Guo
it's done! great~ :) \r can match the ^M. thanks all~ Microsoft costs me several hours -_- 2008/5/21 Bob McConnell <[EMAIL PROTECTED]>: > From: Rob Coops > > > That ^M is a line feed, or well the windows version of a line feed. > > Actually, it is an ASCII CR or carriage return. Microsoft u

RE: what is ^M at the end of a line?

2008-05-21 Thread Bob McConnell
From: Rob Coops > That ^M is a line feed, or well the windows version of a line feed. Actually, it is an ASCII CR or carriage return. Microsoft uses CR/LF for end of line, where Unixen use just LF. Apple used something else, but may have changed when they switched to OSX. I used tr to clean it up

Re: what is ^M at the end of a line?

2008-05-21 Thread Xavier Noria
On Wed, May 21, 2008 at 4:20 PM, Remy Guo <[EMAIL PROTECTED]> wrote: > it's really interesting... then how can i match that ^M using regex? > i've tried "chomp" when reading each line but it doesn't work... That's "\r" everywhere except in Macs before Mac OS X. Some programs display "\r" as "^M"

Re: How to chdir using SFTP or SSH on Win32

2008-05-21 Thread Steve Bertrand
$sftp->chdir( $path ); #cd to the OUT folder $sftp->get( $shortname, $localname); # get the file using only the file name I see no way to do $sftp->chdir. Will $sftp->do_opendir() work? Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

RE: what is ^M at the end of a line?

2008-05-21 Thread Andrew Curry
If your trying to do this on a unix based system ^M is equivalent to \r\n so you can get rid of \r I believe. -Original Message- From: Remy Guo [mailto:[EMAIL PROTECTED] Sent: 21 May 2008 15:20 To: Rob Coops Cc: Perl Beginners Subject: Re: what is ^M at the end of a line? it's really

Re: what is ^M at the end of a line?

2008-05-21 Thread Remy Guo
it's really interesting... then how can i match that ^M using regex? i've tried "chomp" when reading each line but it doesn't work... 2008/5/21 Rob Coops <[EMAIL PROTECTED]>: > That ^M is a line feed, or well the windows version of a line feed. > > There are several different ways in which to wri

DBI question

2008-05-21 Thread Ken Foskey
I have a program that will run literally for days and days. It monitors logs by file tail. Problem is that I think the DBI is causing problems. It is constantly connecting and reconnecting to DB2 for every transaction. What I would like to do is block the subroutine and check the DBI connection

How to chdir using SFTP or SSH on Win32

2008-05-21 Thread Sturdevant, Robert W Mr CTR USA AMC
Hi list, I asked this question a few days ago on the perl-win32-users list but still need some help. It seems what I need may not be possible. I have a perl (5.6) SFTP client (Net::SFTP) that gets and puts files using either a full or relative path with the filename something like this: $sftp->g

Re: How to measure the efficiency, load & performance of a script?

2008-05-21 Thread brian d foy
[[ This message was both posted and mailed: see the "To," "Cc," and "Newsgroups" headers for details. ]] In article <[EMAIL PROTECTED]>, timbo <[EMAIL PROTECTED]> wrote: > Hi all, > > I was just wondering if any general tools / modules exist to help > measure the efficiency of any code. > I k

Re: Sending special chars in email header

2008-05-21 Thread Jeff Peng
On Wed, May 21, 2008 at 7:58 PM, Octavian Rasnita <[EMAIL PROTECTED]> wrote: > Hi, > > I've tried to send some UTF-8 chars in the "To" and "From" fields in the > header of a message, Hi, you need MIME::Words: http://search.cpan.org/~doneill/MIME-tools-5.426/lib/MIME/Words.pm -- Jeff Peng - [EM

Sending special chars in email header

2008-05-21 Thread Octavian Rasnita
Hi, I've tried to send some UTF-8 chars in the "To" and "From" fields in the header of a message, using Mail::Sender, and I also tried more combinations for setting the encoding and charset, but the chars don't appear correctly in the message. It should be possible to use those special chars l

Re: Multiline comment in Perl

2008-05-21 Thread Joshua Hoblitt
On Tue, May 20, 2008 at 07:40:38PM -0400, Robert Hicks wrote: > Cheating...but: > > http://search.cpan.org/~kane/Acme-Comment-1.02/lib/Acme/Comment.pm and dangerous as it's implemented with source filters which can have some "interesting" interactions. -J -- -- To unsubscribe, e-mail: [EMAIL

Perl beginner seeks help

2008-05-21 Thread Mr. low level newb of stupidity ;)
hello, I am a, well, not a beginner per say, but rather still a learner of Perl. I guess you could call me a beginner. anyway, I need some help with my robot. it is not really Perl help, but you guys could help with the code, too. I am making a talking robot like A.L.I.C.E., a robot designed by a g

Re: Multiline comment in Perl

2008-05-21 Thread Paul Johnson
On Mon, May 19, 2008 at 08:42:49PM +0300, Octavian Rasnita wrote: > By the way, what do you think about the following commenting style: > > q/ > the > commented > lines > /; > > It is a valid perl code, and it only gives a warning if "use warnings" is > used, but it is not a problem because we kno

Re: what is ^M at the end of a line?

2008-05-21 Thread sivasakthi
The 'script' utility output normally has ^M and other control characters embedded in the output. To have all these control characters removed, try: $ col -b < script.txt > newfile.txt Regards, Siva On Wed, 2008-05-21 at 16:45 +0800, Remy Guo wrote: > hi all, > i have a text processing scri

Re: what is ^M at the end of a line?

2008-05-21 Thread Rob Coops
That ^M is a line feed, or well the windows version of a line feed. There are several different ways in which to write a line feed and of course to make our lives better *nix, Dos/Windows and Mac all have their own way of writting them. So Jeff's suggestion relies on a little application that sim

Re: what is ^M at the end of a line?

2008-05-21 Thread Jeff Peng
On Wed, May 21, 2008 at 4:45 PM, Remy Guo <[EMAIL PROTECTED]> wrote: > as i compared the 2 files, i found the file that cannot work has a "^M" at > the end of each line. what is this? run "dos2unix filename.txt" to convert it to unix format. you may got the file from windows. -- Jeff Peng - [EM

what is ^M at the end of a line?

2008-05-21 Thread Remy Guo
hi all, i have a text processing script that can work with a file but cannot work with another file that has the same content. as i compared the 2 files, i found the file that cannot work has a "^M" at the end of each line. what is this? is this what made it not work? by the way, i'm under unix. th

Re: No such file or directory

2008-05-21 Thread anthony brooke
- Original Message From: Jeff Peng <[EMAIL PROTECTED]> To: Perl Beginners Sent: Wednesday, May 21, 2008 15:53:00 Subject: Re: No such file or directory > open(RULES, 'rule.pl') please use full path if you don't know where you are exactly. On Wed, May 21, 2008 at 3:45 PM, anthony bro

Re: No such file or directory

2008-05-21 Thread Jeff Peng
> open(RULES, 'rule.pl') please use full path if you don't know where you are exactly. On Wed, May 21, 2008 at 3:45 PM, anthony brooke <[EMAIL PROTECTED]> wrote: -- Jeff Peng - [EMAIL PROTECTED] Professional Squid supports in China http://www.ChinaSquid.com/ -- To unsubscribe, e-mail: [EMAIL

Re: No such file or directory

2008-05-21 Thread anthony brooke
anthony brooke wrote: > Hello, I know that this is a very common problem, but I am very sure that > the file exist in that directory, also its permission is -rwxrwxrwx , why > does it give such an error ? What are the other potential problems that cause > this ? Thanks > > Send instant mes

Re: No such file or directory

2008-05-21 Thread anthony brooke
anthony brooke wrote: > Hello, I know that this is a very common problem, but I am very sure that > the file exist in that directory, also its permission is -rwxrwxrwx , why > does it give such an error ? What are the other potential problems that cause > this ? Thanks > > Send instant mes