Re: a way to make this more secured and better written?

2004-06-22 Thread Jason Gray
"Jason Gray" <[EMAIL PROTECTED]> wrote in message news:... > Could I do this? > > sub check_fields { > my $q = shift; > my $match; > my @fields = ('name', 'email', 'city', 'state', 'message'); > foreach my $field (@fields) { > next if ($q->param($field)); > $match = 0; > print "Please fi

Re: The Proper way to define a global variable.

2004-06-22 Thread John W. Krahn
Jason Corbett wrote: > > Hello. I am using variables that are local in my scripts by doing the my > $variable_name technique. > > Can someone tell me if there is an official way to define a global variable? Perl doesn't really have "global" variables (like BASIC does), except for some of the sp

Re: Pattern match

2004-06-22 Thread John W. Krahn
Naser Ali wrote: > > Naser Ali wrote: > > > >I have an array which was created by slurrping a whole text file. There > >are certain element in the array after reading the files which contain > >only one word. I want to only match those array elements which contain > >a single word and print it. Tr

warning with eval, not with inline

2004-06-22 Thread perl.org
Given this piece of code (where ${components[${i}]} is 'email'): eval { my ${name} = 'IWAPI::ExternalTasks::' . ${components[${i}]}; no strict; eval( &${name}( -files => [EMAIL PROTECTED], -area => ${area}, -wftask => ${wftask}, -wfworkflow => ${wfworkflow} )); use

Re: The Proper way to define a global variable.

2004-06-22 Thread Gunnar Hjalmarsson
Jason Corbett wrote: Can someone tell me if there is an official way to define a global variable? use vars qw($global1 $global2); or our ($global1, $global2); The latter cannot be used in Perl versions previous than 5.6.0. Note that the two methods do not do exactly the same thing; see the

The Proper way to define a global variable.

2004-06-22 Thread jason corbett
Hello. I am using variables that are local in my scripts by doing the my $variable_name technique. Can someone tell me if there is an official way to define a global variable?

RE: [Doubt]: Retrieve System Info like Which OS and type

2004-06-22 Thread Tim Johnson
Check out the Win32::TieRegistry module. It's pretty easy to get that info from the Registry. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 22, 2004 11:32 AM To: [EMAIL PROTECTED] Subject: [Doubt]: Retrieve System Info like Which OS and type H

[Doubt]: Retrieve System Info like Which OS and type

2004-06-22 Thread suresh.pasupula
Hi, I need to retrieve the following system Info from the current system. 1. Operating System 2. Localization 3. 32 Bit or 64 Bit I searched but could get only this info "$^O". This gives only MSWINNT but nut much info. Could anyone let me know where can I such info? Thanks and Rega

Re: regexp needed

2004-06-22 Thread Gunnar Hjalmarsson
Jorge Goncalves wrote: Hi List , I have this to print: 1 2 3 with this script but it didn't work: No, it does not even compile. :( while ($file =~ /^\s+(\d+).(.+)$/) { You always need the /g modifier when using the m// operator that way in a while loop. In this case you also need the /m modif

RE: Using regular expression as a variable.

2004-06-22 Thread Khan, Ahmer H
Thank you for pointing me in the right direction. That did work. Ahmer -Original Message- From: BOLCATO CHRIS (esm1cmb) [mailto:[EMAIL PROTECTED] Sent: Monday, June 21, 2004 10:43 AM To: Khan, Ahmer H; [EMAIL PROTECTED] Subject: RE: Using regular expression as a variable. Hello, >H

RE: regexp needed

2004-06-22 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Goncalves, Jorge (Ext) wrote: > Hi List , I have this to print: > 1 > 2 > 3 > > with this script but it didn't work: > #!/usr/bin/perl > use strict; > use warnings; > > { > local $/; > my $file = ; > while ($file =~ /^\s+(\d+).(.+)$/) { > print $1\n if $2 =~ /extractStat/

open CONSOLE?

2004-06-22 Thread perl.org
Hi, Is there a way to explicitly open a handle to the "console", or wherever STDOUT/STDERR are directed to by default? My process is running in an environment in which STDOUT and STDERR have already been redirected. I want to intercept these streams when running command line tools, then resto

Re:regexp needed

2004-06-22 Thread Goncalves, Jorge (Ext)
Hi List , I have this to print: 1 2 3 with this script but it didn't work: #!/usr/bin/perl use strict; use warnings; { local $/; my $file = ; while ($file =~ /^\s+(\d+).(.+)$/) { print $1\n if $2 =~ /extractStat/; } } __DATA__ ?tatID Jour

Re: how to sort certain pattern from a file

2004-06-22 Thread James Edward Gray II
On Jun 16, 2004, at 2:25 PM, Naser Ali wrote: Thanks James, I totally agree with you and appreciate your comments. I was going to refine the whole code by putting in better logic, naming convention, and error handling. I just posted the code baically to share the basic logic of handling the situat

Re: Pattern match

2004-06-22 Thread Gunnar Hjalmarsson
Naser Ali wrote: It works, What is it that works? The data pattern looks like this; Aword Yep, that's one word. Aword Anotherword That's two words. None of the posted suggestions matches that line. You said in your original post: "I want to only match those array elements which contain a single wo

RE: cut and substitute

2004-06-22 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Virmani, Amit (GMI Debt Technology) wrote: > Problem: > I have a field $cusip that has to change from ABC123-XX-7 (9 > characters with '-') to ABC123XX (first 8 characters only without > '-') If the field is truly a constant as you state, then two substr would be just as good: $c

cut and substitute

2004-06-22 Thread Virmani, Amit (GMI Debt Technology)
Problem: I have a field $cusip that has to change from ABC123-XX-7 (9 characters with '-') to ABC123XX (first 8 characters only without '-') I have following lines of code: : : $cusip =~ s/\-//g; $cusip =~/.${8}$/$1/g; : : Is there a shorter way to transform this. - Amit ===

RE: Pattern match

2004-06-22 Thread Naser Ali
Thanks to all who responded. Much appreciated. It works, but please allow me to sight an example. The data pattern looks like this; Aword Some Alphanumeric long string columnized format Some Alphanumeric long string columnized format Some Alphanumeric long string columnized format Aword Some Alph

Frontier::RPC2

2004-06-22 Thread Ashish Srivastava
Hi, Has any body used Frontier::RPC2 to made XMLRPC CGI server. I need some example code. Thanks in advance. /Ashish/ __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail -- To unsubs

Re: Comparing Directories

2004-06-22 Thread LRMK
This must do the job but there must be a more nice looking way of doing this Code ___ compare("c:\\program files","d:\\program files"); #Example call sub compare($$){ my ($p1, $p2) [EMAIL PROTECTED]; print "comparing $p1 with

OOPS Sorry abat that

2004-06-22 Thread Amit Kulkarni
Accidently chose a wrong News-Group. but if you know ans. Your Welcome. THANX, AMIT K. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

HOW-TO Truncate first line in a file to zero length?

2004-06-22 Thread Amit Kulkarni
Hi, I have small problem. I want to truncate a line in a text file using C file handling functions and write new line in place of it. How do I do it? e.g. "example.txt" Line 1: This is a text file. Line 2: Second line of it. Now I want to truncate first line and replace it with suppose followin

Re: VARIABLES

2004-06-22 Thread Sripathi Guruprasannaraj
http://www.perl.com/pub/a/2004/06/18/variables.html On Fri, 18 Jun 2004 12:38:43 -0400, <[EMAIL PROTECTED]> wrote: All, Does perl have built in variable names such as in awk? Here are the ones in awk I know perl uses ARGV, but what about: ARGC # of command lines arguments FILENAME name of current

Re: VARIABLES

2004-06-22 Thread Sripathi Guruprasannaraj
On Fri, 18 Jun 2004 12:38:43 -0400, <[EMAIL PROTECTED]> wrote: All, Does perl have built in variable names such as in awk? Here are the ones in awk I know perl uses ARGV, but what about: ARGC # of command lines arguments - In the array @ARGV FILENAME name of current input file - current input file

Comparing Directories

2004-06-22 Thread sudhindra k s
  Hi I have two directories with a path as shown below c:\test\result\... and d:\test2\result2\... The directory stucture and files after these are the same. i.e if there is a directory xyz within c:\test\result\, there will be a corresponding directory xyz within d:\test2\result2\ with the fi