Re: Working with files

2007-02-23 Thread Ken Foskey
On Thu, 2007-02-22 at 23:20 +0530, Dharshana Eswaran wrote: > I forgot to mention, First step is to Search for the file in which the > string occurs A list of files use either function glob or opendir (perldoc -f ???) I wonder how you are going to check for a string without opening it. You may

Re: Detecting string in string

2007-02-23 Thread Ken Foskey
On Thu, 2007-02-22 at 08:31 -0800, [EMAIL PROTECTED] wrote: > Hello > > I am not an advanced perl programmer and I do not have my books with > me. I want to determine if a string is within a string and to not > process the string if the string is found. Could someone please > provide a simple samp

Re: File uploading using CGI

2007-02-23 Thread Mug
Zembower, Kevin wrote: >open(TMP_FILE, ">$tmp_file_name") or die "Can't open temp upload file > $tmp_file_name\n"; > Do you want binmode() here? I see you'll use BINARY below. >my $fh = $query->upload('Material_File'); >while (<$fh>) { > print TMP_FILE; >} # while there's m

Re: Working with files

2007-02-23 Thread Dr.Ruud
Jeff Pang schreef: > [processing .h files] > next if $file eq '.' or $file eq '..'; > next if $file !~ /\.h$/; Those two lines can be replaced by file =~ /\.h$/ or next; > return $. if /$string/; If the string can contain regex-special characters, then always use quote

RE: File uploading using CGI

2007-02-23 Thread Zembower, Kevin
Mug, thanks for writing. According to the documentation on binmode, "Binmode has no effect under Unix." I'll try it anyway and let the list know if it seems to have any effect. Thanks for the reminder about the error condition with unlink. -Kevin -Original Message- From: Mug [mailto:[EMAI

RE: File uploading using CGI

2007-02-23 Thread Zembower, Kevin
Mumia, I don't think the problem is in sending the file out. When the file is recorded on /tmp/, its size is zero. The files I'm uploading are at least 1KB. Something's wrong with reading the file from the uploaded filehandle, I believe. Your example takes for granted a properly written file on dis

Re: File uploading using CGI

2007-02-23 Thread Randal L. Schwartz
> ""Zembower," == "Zembower, Kevin" <[EMAIL PROTECTED]> writes: "Zembower,> I'm having problems uploading a file with perl and CGI.pm. beginners-cgi@perl.org was specifically set up for this type of problem. Just FYI, because you were also already helped here. -- Randal L. Schwartz - Stone

term::readline, need to change default prompt char props

2007-02-23 Thread Gauthier, Dave
Hi: I'm experimenting with Term::Readline as a way to emulate a CLI from within perl. One of the annoying things it does is to alter the display characteristics of the string I ask the "readline" method to use as a prompt. It always gets underlined, sometimes the color gets changed and someti

Re: term::readline, need to change default prompt char props

2007-02-23 Thread Tom Phoenix
On 2/23/07, Gauthier, Dave <[EMAIL PROTECTED]> wrote: I'm experimenting with Term::Readline as a way to emulate a CLI from within perl. One of the annoying things it does is to alter the display characteristics of the string I ask the "readline" method to use as a prompt. It always gets underl

Re: Perl Parsing

2007-02-23 Thread Jefferson Kirkland
On 2/21/07, Sumit Shah <[EMAIL PROTECTED]> wrote: Hello All, I have a string like: 'a = 1; b = 2; c = 3; d = 4' Whats the best way to parse it so that I can get a value for c, which is 3? I have used the hash approach. But, I was wondering if there is a faster way to do it in Perl. Well, fr

Re: File uploading using CGI

2007-02-23 Thread Mumia W.
On 02/23/2007 09:06 AM, Zembower, Kevin wrote: Mumia, I don't think the problem is in sending the file out. When the file is recorded on /tmp/, its size is zero. The files I'm uploading are at least 1KB. Something's wrong with reading the file from the uploaded filehandle, I believe. Your examp

RE: File uploading using CGI

2007-02-23 Thread Zembower, Kevin
I owe this list, and Mumia in particular, an apology. Apparently, my script was working yesterday when I was asking for help. I'm guessing that at some point, I made a change to the HTML input form and forgot to refresh the copy in my browser. For the rest of yesterday, it continued to appear to ma

Re: Perl Parsing

2007-02-23 Thread Rob Dixon
Sumit Shah wrote: I have a string like: 'a = 1; b = 2; c = 3; d = 4' Whats the best way to parse it so that I can get a value for c, which is 3? I have used the hash approach. But, I was wondering if there is a faster way to do it in Perl. What do you mean by 'the hash approach'? Can you po

perl errors: Unrecognized escape characters.............

2007-02-23 Thread Nishi Bhonsle
Hi: I see these errors when i run my perl script. Unrecognized escape \B passed through at C:\test.pl line 41. Unrecognized escape \o passed through at C:\test.pl line 41. Unrecognized escape \W passed through at C:\test.pl line 41. Unrecognized escape \W passed through at C:\test.pl line 41. Unr

Re: perl errors: Unrecognized escape characters.............

2007-02-23 Thread Tom Phoenix
On 2/23/07, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Unrecognized escape \B passed through at C:\test.pl line 41. The perldiag manpage sez: (W misc) You used a backslash-character combination which is not recognized by Perl. "This perl script accepts 5 arguments. The syntax is: <---

RE: Perl Parsing

2007-02-23 Thread Sumit Shah
I am doing the following: my $cookie = $r->headers_in->{'Cookie'}; my @cookieArray = split(/\;\s/,$cookie); my %hashMap; my $cookieItem; foreach $cookieItem (@cookieArray){ my @subArray = split("=",$cookieItem); my $key = $subArray[0];

RE: Perl Parsing

2007-02-23 Thread Sumit Shah
Thanks Ralph. It worked. Sumit -Original Message- From: Ralph Moritz [mailto:[EMAIL PROTECTED] Sent: Wed 2/21/2007 12:54 PM To: beginners@perl.org Cc: Subject: Re: Perl Parsing [EMAIL PROTECTED] (Sumit Shah)

Re: Perl Parsing

2007-02-23 Thread Rob Dixon
Sumit Shah wrote: > > Rob Dixon wrote: >> >>> Sumit Shah wrote: >>> >>> I have a string like: 'a = 1; b = 2; c = 3; d = 4' >>> >>> Whats the best way to parse it so that I can get a value for c, which is >>> 3? I have used the hash approach. But, I was wondering if there is a >>> faster way to do

Re: File uploading using CGI

2007-02-23 Thread Mumia W.
On 02/23/2007 12:36 PM, Zembower, Kevin wrote: I owe this list, and Mumia in particular, an apology. Apparently, my script was working yesterday when I was asking for help. I'm guessing that at some point, I made a change to the HTML input form and forgot to refresh the copy in my browser. For