what is a .ph file

2002-12-20 Thread Ramprasad
I was just going thru some perl tutorial I came across 'h2ph' utility which converts c header files to .ph files Ok man h2ph would give this much information , but what is the use of h2ph. When I have the need of any modules I create Packages and 'require' or 'use'. I never till now required to

RE: Expanding a variable

2002-12-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
print $file . "\n"; Puts to STDOUT (Screen) what is in $file. Wags ;) -Original Message- From: Bob H [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 16:57 To: [EMAIL PROTECTED] Subject: Expanding a variable If I have a variable that I used to a regex to populate how c

Expanding a variable

2002-12-20 Thread Bob H
If I have a variable that I used to a regex to populate how can I now expand that variable? Ex: I have a variable $file that I use a regex to match a file in a directory and put that match into $file. Now I want to get that info out of the $file variable and use it in a system() call. Bob

Re: one more regex match elements in an array question

2002-12-20 Thread Paul Johnson
On Fri, Dec 20, 2002 at 09:13:41PM -, Rob Dixon wrote: > Please explain about that useful-looking command-line syntax. It looks to be > equivalent to > > use O qw(Deparse -p); Yep. that's it. > but I've never heard of module 'O'. O.pm is the interface to the B compiler modules. In thi

Re: Passing array to a function

2002-12-20 Thread Satya_Devarakonda
Thank you so much!!! I could not hold to check things for myself. Satya::Novice_City; ---

Re: Passing array to a function

2002-12-20 Thread John W. Krahn
Rob Richardson wrote: > > I will take your word that "$a = (3, 2, 1);" returns 1. I think I was > thinking of "$a = [3, 2, 1];", in which an anonymous array would be > created and $a would return 3, the number of elements in the array. > > NOT!!! > > The above is what I was going to say when I

Re: Reply address on this list

2002-12-20 Thread Rob Dixon
Funnily enough, this is exactly where I was a couple of days ago. I think you are stuck this way if you can only receive e-mail, but if you can register nntp.perl.org as a NNTP server the just subscribe to the perl.beginners newsgroup. You'll then get both a 'Reply' and a 'Reply to Group' toolbar b

Reply address on this list

2002-12-20 Thread Rob Richardson
Greetings! A small off-list discussion is included with this message because, as Rob Dixon says, it is on topic. But that's not the purpose of this message. I am using Yahoo Mail to read messages from this group. When I click the Reply button on a message, the E-mail address that is filled in

Re: Passing array to a function

2002-12-20 Thread Rob Dixon
"Rob Richardson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Rob, > > I will take your word that "$a = (3, 2, 1);" returns 1. I think I was > thinking of "$a = [3, 2, 1];", in which an anonymous array would be > created and $a would return 3, the number

Re: Passing array to a function

2002-12-20 Thread Rob Richardson
Rob, I will take your word that "$a = (3, 2, 1);" returns 1. I think I was thinking of "$a = [3, 2, 1];", in which an anonymous array would be created and $a would return 3, the number of elements in the array. NOT!!! The above is what I was going to say when I started typing this, but then I r

Re: one more regex match elements in an array question

2002-12-20 Thread Rob Dixon
OK first round to you! Please explain about that useful-looking command-line syntax. It looks to be equivalent to use O qw(Deparse -p); but I've never heard of module 'O'. Is it anything to do with the Powerpuff Girls' Chemical X? Puzzled, /R "Paul Johnson" <[EMAIL PROTECTED]> wrote in me

Re: Broken Pipe on Input?

2002-12-20 Thread John W. Krahn
Jess Balint wrote: > > Hi all. Can anybody tell me why I get a broken pipe on the following? I just > can figure it out. Thanks. > > jess > > # Get all possible states from the files > open( STATES, "sort $hotline |" ) > or cust_die( "Cannot open files to get states > ($hotline,$newtofi

Re: Perl and arrays

2002-12-20 Thread John W. Krahn
"John W. Krahn" wrote: > > #!/usr/bin/perl -w > use strict; > use CGI qw/:standard/; > > print header; > > my @arrayStuff = ( > { OutFile => 'albu.htm', > PageId => '3.4.1.5.1', > Menu=> 'albu_menu.inc', > Content => 'albu.inc' > }, > { OutFile => 'armi.php', >

RE: CGI.pm param

2002-12-20 Thread Dan Muey
Actually the form has several checkboxes with the same name. I figured it out though. The script went through all params in a loop in scalar context so that made that param a single value. SO the correct format I found to be @array $cgi->param('checkbox'); The above does get an array but only

Re: Perl and arrays

2002-12-20 Thread John W. Krahn
Colin Johnstone wrote: > > Gidday all, Hello, > I want to create an array and then remove elemnets one at a time and split on the >comma. > > I've tried this with no success.. > > #!/usr/bin/perl -w > > print "Content-Type: text/html\n\n"; > > my @arrayStuff; > > $arrayStuff[0] = "albu.htm

Re: CGI.pm param

2002-12-20 Thread Rob Dixon
Dan Dan Have you generated a checkbox with $cgi->checkbox (-name => 'checkboxname', ...) because this will create only an isolated single checkbox. To create a group of checkboxes use $cgi->checkbox_group (-name => 'groupname', ...) which will then return a list of only the _checked_

Broken Pipe on Input?

2002-12-20 Thread Balint, Jess
Hi all. Can anybody tell me why I get a broken pipe on the following? I just can figure it out. Thanks. jess # Get all possible states from the files open( STATES, "sort $hotline |" ) or cust_die( "Cannot open files to get states ($hotline,$newtofile,$newmover): $!\n" ); while(

CGI.pm param

2002-12-20 Thread Dan Muey
Hello, I'm starting to use CGI.pm to parse input instead of cgi_lib.lib What I need to do is get the values of a series of checkboxes into an array so I can do foreach over them . EXAMPLE : @check_box_entries = $cgi->param('checkboxname'); $check_box_entries = $cgi->param('checkboxname')

Re: how to use alarm() to properly time out a connection?

2002-12-20 Thread Jenda Krynicky
Date sent: Fri, 20 Dec 2002 13:00:59 -0500 From: Ian Zapczynski <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject:how to use alarm() to properly time out a connection? > I need to use alarm to time out a connection to an SFTP serve

Re: Redirecting Output

2002-12-20 Thread Sugumar
Thanks for your responses. Regards, Sugumar Bob Showalter wrote: -Original Message- From: Sugumar [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 2:47 PM To: [EMAIL PROTECTED] Subject: Redirecting Output Hi, I'm trying this command from my perl program system ( "perldoc

Re: how to use alarm() to properly time out a connection?

2002-12-20 Thread Kipp, James
> > eval { > $sftp = Net::SFTP->new($FTPHOST, user=>$FTPUSER, > password=>$FTPPASS); > local $SIG{ALRM} = sub { die "alarm\n" }; > alarm 60; > }; > > if ($@) { > &sendSNMP unless $@ eq "alarm\n"; > } > > When I run the test code with the

Re: how to use alarm() to properly time out a connection?

2002-12-20 Thread Ian Zapczynski
Jose, Yes, you are correct. I did not know about placing the alarm prior to the hanging condition (gee, I guess that makes sense) or clearing the alarm afterwards. Thank you! -Ian NYIMI Jose (BMB) wrote: -Original Message- From: Ian Zapczynski [mailto:[EMAIL PROTECTED]] Sent: Frid

RE: how to use alarm() to properly time out a connection?

2002-12-20 Thread NYIMI Jose (BMB)
> -Original Message- > From: Ian Zapczynski [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 20, 2002 7:01 PM > To: [EMAIL PROTECTED] > Subject: how to use alarm() to properly time out a connection? > > > Hello all, > > I need to use alarm to time out a connection to an SFTP server i

RE: PERL string manipulation

2002-12-20 Thread Kipp, James
> vec() is a bit squirrelly. In a nutshell (heh), vec views its first > argument as a stream of bits taken from the string. The third > argument tells how many bits form a chunk. 8 bits gives chunks that > can each have values from 0 to 255. The second argument tells *which* > chunk, numbering

how to use alarm() to properly time out a connection?

2002-12-20 Thread Ian Zapczynski
Hello all, I need to use alarm to time out a connection to an SFTP server if the connection hangs (I was able to reproduce such a hang using the Secure Shell Server for Windows, so I thought it would be nice if my script assumed this was a possibility). I think I am not understanding the perld

RE: newbie

2002-12-20 Thread Jenda Krynicky
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > Thanks to all, > > it working!!! > > RobR: for $i,I thinking i need give parameter into table before use > it. > > fi each "ARGV" i put " from ' and it working > > the correct script is : > #!/usr/bin/perl -w > > use Mail::Sender; > > > $sende

Re: PERL string manipulation

2002-12-20 Thread Randal L. Schwartz
> "James" == James Kipp <[EMAIL PROTECTED]> writes: >> vec( $output, length $output, 8 ) = ord "E"; James> is it just me or do others on this list have a tough time understanding the James> vec() function? vec() is a bit squirrelly. In a nutshell (heh), vec views its first argument as a stre

RE: 'foreach' and error diagnosis

2002-12-20 Thread Beau E. Cox
Hi - After a quick look... foreach $line(@db) # ... put a space here ^ foreach $line (@db) # ... next $line; no,no,no, the next line is taken care of by for(each) automatically. my $newQA = ""; # ... defined as a scalar ($) but you use it as an array

RE: 'foreach' and error diagnosis

2002-12-20 Thread wiggins
On Fri, 20 Dec 2002 16:31:55 +, Al Lukaszewski <[EMAIL PROTECTED]> wrote: > Greetings, > > I'm writing a script that is intended to read in a comma-delimited > file called "qa.db" line-by-line. Each line is split into fields and > the first t

'foreach' and error diagnosis

2002-12-20 Thread Al Lukaszewski
Greetings, I'm writing a script that is intended to read in a comma-delimited file called "qa.db" line-by-line. Each line is split into fields and the first two fields are evaluated. The first field is a line reference; the second is a lemma. If the line reference is the same as the previous en

RE: killing a hash

2002-12-20 Thread wiggins
Or let it go out of scope, but then it is no longer available to re-add to. This works well within loops however, where it will be newly initialized. http://danconia.org On Sat, 21 Dec 2002 01:32:43 +1100, "Johnstone, Colin" <[EMAIL PROTECTED]> w

RE: killing a hash

2002-12-20 Thread Kipp, James
undef %hash; > -Original Message- > From: Johnstone, Colin [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 20, 2002 9:33 AM > To: '[EMAIL PROTECTED]' > Subject: killing a hash > > > Gidday all, > > to kill an array or reset it you do > > @arrayname(); > > how do you reset a has

RE: killing a hash

2002-12-20 Thread Bob Showalter
> -Original Message- > From: Johnstone, Colin [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 20, 2002 9:33 AM > To: '[EMAIL PROTECTED]' > Subject: killing a hash > > > Gidday all, > > to kill an array or reset it you do > > @arrayname(); Actually, its @arrayname = (); > >

RE: REGEXP help asap :)

2002-12-20 Thread Kipp, James
> Here our two reg expr. The first returns all the data I need > except data > that starts "~MISC~". > > if (/\s+(\w{4,4}00).+\s+([\d,.]+)/){ # $1 = /\w\w\w\w00 > if (/\s+((\w{4,4}00)||~MISC~)).+\s+([\d,.]+)/){ # same > expression but > I need it to match if its \w\w\w\w00 or ~MISC~ Well I

RE: newbie

2002-12-20 Thread [EMAIL PROTECTED]
Thanks to all, it working!!! RobR: for $i,I thinking i need give parameter into table before use it. fi each "ARGV" i put " from ' and it working the correct script is : #!/usr/bin/perl -w use Mail::Sender; $sender = new Mail::Sender {smtp => 'server.smtp.com', from => '[EMAIL PROTECTED]'} o

RE: REGEXP help asap :)

2002-12-20 Thread Paul Kraus
got it. I only need one set of () and only |. > -Original Message- > From: Paul Kraus [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 20, 2002 9:30 AM > To: 'Perl' > Subject: REGEXP help asap :) > Importance: High > > > I have a 23,000 accounting error I have to find before 12 > wh

RE: Redirecting Output

2002-12-20 Thread Bob Showalter
> -Original Message- > From: Sugumar [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 19, 2002 2:47 PM > To: [EMAIL PROTECTED] > Subject: Redirecting Output > > > Hi, > > I'm trying this command from my perl program system ( > "perldoc perldsc > > tmp.txt"). I don't see the output

killing a hash

2002-12-20 Thread Johnstone, Colin
Gidday all, to kill an array or reset it you do @arrayname(); how do you reset a hash %hashname; Regards Colin Johnstone

REGEXP help asap :)

2002-12-20 Thread Paul Kraus
I have a 23,000 accounting error I have to find before 12 when my boss comes in or one of my employees is going to get reamed. To but it nicely. Here our two reg expr. The first returns all the data I need except data that starts "~MISC~". if (/\s+(\w{4,4}00).+\s+([\d,.]+)/){ # $1 = /\w\w\w\w00

RE: newbie

2002-12-20 Thread Kipp, James
> > #!/usr/bin/perl > > use Mail::Sender; > $i = scalar (@ARGV); > > $sender = new Mail::Sender > {smtp => 'server.smtp.com', from => '[EMAIL PROTECTED]'}; > $sender->MailFile({to => '[EMAIL PROTECTED]', >subject => '$arg[0]', >msg => "$arg[1]", >

Re: newbie

2002-12-20 Thread Ramprasad
in shell scripts you get arguments in $1 $2 $3 etc similarly in perl scripts you get $ARGV[0] ( starts from 0 ) $ARGV[1] etc [EMAIL PROTECTED] wrote: hi, i'm newbie in perl language and i need help. I search from 3 days how give parmeter ti perl script same as shell script. If someone can he

Re: newbie

2002-12-20 Thread Paul Johnson
On Fri, Dec 20, 2002 at 03:10:16PM +0100, [EMAIL PROTECTED] wrote: > #!/usr/bin/perl > > use Mail::Sender; > $i = scalar (@ARGV); > > $sender = new Mail::Sender > {smtp => 'server.smtp.com', from => '[EMAIL PROTECTED]'}; > $sender->MailFile({to => '[EMAIL PROTECTED]', >subjec

RE:_newbie

2002-12-20 Thread Rob Richardson
Damien, Where is the "arg" array being populated? If you replace "arg" with "ARGV" in your call to MailFile then maybe it would work. You'd also have to replace the single quotes with double quotes. If you use single quotes, you just get the string between the quotes. If you use double quotes,

RE: newbie

2002-12-20 Thread [EMAIL PROTECTED]
Thanks, the script is the following: #!/usr/bin/perl use Mail::Sender; $i = scalar (@ARGV); $sender = new Mail::Sender {smtp => 'server.smtp.com', from => '[EMAIL PROTECTED]'}; $sender->MailFile({to => '[EMAIL PROTECTED]', subject => '$arg[0]', msg => "$arg

RE: newbie

2002-12-20 Thread Kipp, James
do you mean command line parameters? for that, you manipulate the @ARGV array. or you could use one of the getopt modules. let us know what you are trying to do and we will help you > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 20, 2002

RE: newbie

2002-12-20 Thread wiggins
Parameters on the command line are stored automagically by Perl in the @ARGV array. You may also want to check out the standard GetOpt modules. http://danconia.org On Fri, 20 Dec 2002 14:37:55 +0100, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrot

RE: PERL string manipulation

2002-12-20 Thread Mystik Gotan
No, it's not hard. vec and ord are simply used for translating ASCII characters to their corresponding characters, well, let's say, numbers. Say like %20 represents a space. Anyway, check out: perldoc -f vec perldoc -f ord It's really simple :) -- Bob Erinkveld (Webmaster Insane Hos

newbie

2002-12-20 Thread [EMAIL PROTECTED]
hi, i'm newbie in perl language and i need help. I search from 3 days how give parmeter ti perl script same as shell script. If someone can help me? thanks Damien - SPECIAL ADSL L'ADSL Tiscali est à partir de 15,95 EUR/mois ! Plus modem ADSL et frais d'activation gratuits ! Pour

RE: PERL string manipulation

2002-12-20 Thread Kipp, James
> vec( $output, length $output, 8 ) = ord "E"; is it just me or do others on this list have a tough time understanding the vec() function? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: one more regex match elements in an array question

2002-12-20 Thread Paul Johnson
On Fri, Dec 20, 2002 at 12:11:42PM -, Rob Dixon wrote: > We make a good team Paul ;-} :-) But you do actually need the parens in the index call, otherwise the precedence is wrong: $ perl -MO=Deparse,-p -e '@match = grep { index $_, $string >= 0 and $_ ne $string } @array;' (@match = grep({

How Perl Powers Christmas

2002-12-20 Thread Richard A. Nakroshis
If you haven't seen it yet, O'Reilly has a wonderful tongue-in-cheek article titled "How Perl Powers Christmas". http://www.perl.com/pub/a/2002/12/18/hohoho.html Rick -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: one more regex match elements in an array question

2002-12-20 Thread Rob Dixon
We make a good team Paul ;-} "Paul Johnson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I don't know about better, but why not code it exactly as you describe > it? > > @match = grep { index($_, $string) >= 0 and $_ ne $string } @array; > > This has the

Re: Redirecting Output

2002-12-20 Thread Rob Dixon
I don't know too much about redirecting output in Unix, but whatever will work on the command line should work in system(). Within perl, you can achieve the same effect with: open TMP, "> tmp.txt"; print TMP foreach `perldoc perldsc`; close TMP; HTH, Rob "Sugumar" <[EMAIL PROTECTED

Re: one more regex match elements in an array question

2002-12-20 Thread Paul Johnson
On Fri, Dec 20, 2002 at 05:00:04PM +0530, Ramprasad wrote: > hello all > > Assume the foll > > $string='mail.com'; > @array=qw(mail.com one.mail.com two.mail.com mail.com/one mail1.com); > > @match = grep{..}@array; > > I want to match all that *contain* $string but is not equal to $string >

Re: one more regex match elements in an array question

2002-12-20 Thread Rob Dixon
Ramprasad Yours isn't a general solution anyway, as any periods in your string will match any character in a list entry. I would use the plainer: @match = grep { index $_, $string >= 0 and $_ ne $string } @array; Cheers, /R "Ramprasad" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED

Re: Closure definition (was: Passing array to a function)

2002-12-20 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > > On Thu, 19 Dec 2002 17:44:22 +0100, "Jenda Krynicky" > <[EMAIL PROTECTED]> wrote: > > > This is: > > sub createClosure { > > my $x = shift; > > return sub { print $x++,"\n" } > > } > > > >

one more regex match elements in an array question

2002-12-20 Thread Ramprasad
hello all Assume the foll $string='mail.com'; @array=qw(mail.com one.mail.com two.mail.com mail.com/one mail1.com); @match = grep{..}@array; I want to match all that *contain* $string but is not equal to $string so I came up with @match = grep{/^$string.+/ || /.+$string$/} @array; is there

Re: Reg ex help!

2002-12-20 Thread Rob Dixon
Hi Colin You may prefer this: $line =~ s/[\d\s()]+$//g; which will remove all trailing whitespace, digits and parentheses from string $line. Rob "Colin Johnstone" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Gidday All, > > Im reading course names in

RE: Perl and arrays

2002-12-20 Thread Johnstone, Colin
Thank You Ramprasad, Silly me, the previous time I used this regex the fileds were tab delimited. It's been a long day her in Sydney Town, my concentration is starting to waver. Regards Colin -Original Message- From: Ramprasad [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 200

Re: Perl and arrays

2002-12-20 Thread Ramprasad
just one mistake in the code Your elements are comma seperated and you are doing @data = split( /\t/, $element); do a @data = split( /,/, $element); - Ram Colin Johnstone wrote: Gidday all, I want to create an array and then remove elemnets one at a time and split on the comma. I've t

Perl and arrays

2002-12-20 Thread Johnstone, Colin
Gidday all, I want to create an array and then remove elemnets one at a time and split on the comma. I've tried this with no success.. #!/usr/bin/perl -w print "Content-Type: text/html\n\n"; my @arrayStuff; $arrayStuff[0] = "albu.htm,3.4.1.5.1,albu_menu.inc,albu.inc"; $arrayStuff[1] = "armi.