Re: making phone calls using a perl module
On Wed, 27 Feb 2002, Joe Echavarria wrote: >I am looking for a perl module that can be used to > make phone calls using a voice modem so when the phone > is picked up the user can hear a recorded message > (mp3 file). Any idea where i can find that module. Oh, boy, phone spam. -- Brett http://www.chapelperilous.net/ Yawd [noun, Bostonese]: the campus of Have Id. -- Webster's Unafraid Dictionary -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
making phone calls using a perl module
Hi there, I am looking for a perl module that can be used to make phone calls using a voice modem so when the phone is picked up the user can hear a recorded message (mp3 file). Any idea where i can find that module. Thanks, Joe __ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating a string with quotes and delimiters from an Array
You're right, I was thinking of *? -Original Message- From: Luke Bakken [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 3:31 PM To: Timothy Johnson Subject: RE: Creating a string with quotes and delimiters from an Array {0,1} is equivalent to ? On Wed, 27 Feb 2002, Timothy Johnson wrote: > > I guess I should have put this: !~ /^[-+]{0,1}\d+(.\d+){0,1}$/ since > there's really no time that you will need more than one positive or negative > in one number. > > -Original Message- > From: Timothy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 27, 2002 3:05 PM > To: 'Angus Laycock'; Tanton Gibbs; [EMAIL PROTECTED] > Subject: RE: Creating a string with quotes and delimiters from an Array > > > > maybe you can replace =~ /\D/ with "!~ /^[-+]?\d+(.\d+){0,1}$/" *whew* > > which means "does not equal: > >start with zero or more - or + # ^[-+]? >followed by one or more digits # \d+ >followed by zero or one sets of a period followed by one or more digits > at the end of the string # (.\d+){0,1}$ > > -Original Message- > From: Angus Laycock [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 26, 2002 10:41 AM > To: Tanton Gibbs; [EMAIL PROTECTED] > Subject: Re: Creating a string with quotes and delimiters from an Array > > > What about on negative numbers like -1? They come up with quotes, any ideas? > > Thanks > > Gus > - Original Message - > From: Tanton Gibbs <[EMAIL PROTECTED]> > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, February 27, 2002 10:53 PM > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > I apologize for not stating it earlier...mea culpa (and if I didn't have > the > > time, I shouldn't post to the beginners list anyway!) > > > > the ? : operator is like an if else statement > > if actually expands to (sort of) > > > > if( /\D/ ) { > > $string .= "'$_',"; > > } > > else { > > $string .= "$_,"; > > } > > > > The regular expression /\D/ matches anything that is not a digit. Since > we > > do not provide a variable for it to operate on, it chooses the default > > variable $_ which is set by the preceeding foreach loop. The .= is the > > string concatenation operator with assignment...it actually expands to > > $string = $string . "'$_',"; > > > > Hope this helps! > > Tanton > > - Original Message - > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, February 26, 2002 1:33 PM > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > I know I now have the result but how does it do it? > > > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > > > If you have the time. > > > > > > Thanks again > > > > > > Gus > > > > > > > > > - Original Message - > > > From: Tanton Gibbs <[EMAIL PROTECTED]> > > > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Wednesday, February 27, 2002 10:30 PM > > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > > > > Your best bet is to do this with a foreach loop > > > > > > > > my $string = ''; > > > > my @array = qw( alf bert charlie 4 ) > > > > foreach( @array ) { > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > } > > > > - Original Message - > > > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Tuesday, February 26, 2002 1:07 PM > > > > Subject: Creating a string with quotes and delimiters from an Array > > > > > > > > > > > > Hi, > > > > > > > > I have an array > @array = qw(alf bert charlie 4) > > > > > > > > and I want a string that contains this value < > > 'alf','bert','charlie','4' > > > > > > > > with the single quotes and commas. > > > > > > > > I know I can do this $string = join ( ',' , @array); which gives me > > > > this > < one|two|three|four> but how do I get the single quotes > > around > > > > each word. > > > > > > > > > > > > Also, how can I check if one of the values is numeric so I dont put > > quotes > > > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > > > > > > > > Thanks > > > > > > > > > > > > Gus > > > > > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > This email may contain confidential and privileged > material for the sole use of the intended recipient. > If you are not the intended recipient, please contact > the sender and delete all copies. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [
Re: perl2exe
If you're trying to run a Unix perl script on the Unix system, you could probably create an MS-DOS batch file that logs onto the remote system, then runs your perl script there, or runs a shell script wrapped around the perl script. On the other hand, if the script is runnable directly on the Windows system -- i.e., does something with files on the Windows system, and if you have a Unix-like shell (e.g. cygwin's bash) available to the Windows system, and access to the Unix filesystem from Windows, you could wrap an MS-DOS batch file around it like this: bash -c " -w [] 2>&1 | less". If you don't care about looking at the text output, you could probably even skip the bash and just put " -w " in the batch file. In either case, your users could run the batch file from a DOS window, or you can create a shortcut to the batch file and an icon for them to click on. Garyl Erickson Craig Williams wrote: > > Does anyone know - will perl2exe (or a different package to create an > .exe) allow >a perl script to be launched from windows explorer EVEN > THOUGH the script is written for unix (and is sitting on a unix > netowrk drive)? . . . -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
On Tue, Feb 26, 2002 at 07:13:52PM -, Angus Laycock wrote: > I am trying to handle parameters from UNIX that call a PERL script the uses > DBI, that then calls Sybase stored procedures. > > The problem I have found is that they don't pass the strings with single > quotes and dates are 02-27-02, again without quotes. So I tried to quote > them but found that they pass some numbers as well for "int" datatypes and > some are negative and some are positive. With DBI quoting can be handled automatically with placeholders, or manually with the quote() method ($dbh->quote). These methods of quoting should be driver-specific, so it should handle the int datatypes correctly. I'd suggest using placeholders; you can read about them in perldoc DBI. With the method you're currently using, by manually quoting and joining, you're not accounting for single quotes in the data. Allowing such quotes through can, at best, cause SQL errors, at worst provide an exploit potential. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regex...
Daniel Falkenberg wrote: > > Hey all, Hello, > I am just working on a small text file and was wondering if a regular > expression would help me here. Basically the text file looks like > this... > > User data query User data query Time utilization for this billing period > Pre-paid hours: 744 Hours used so far: 29.55 Excess hours billed at: > $1.00 per hour Traffic utilization for this billing period Pre-paid > megabytes: 500 Megabytes used so far: 60.52 Excess Megabytes billed > at: $0.18 per Megabyte > > Now I want to extract the following... > > 1: All digits after Pre-paid hours: including a period (.). > 2: All digits after Hours user so far: including a period (.). > 3: All digits after Excess Hours billed at: including a period (.). > 4: All digits after Pre-paid megabytes: including a period (.). > 5: All digits after Used so far: including a period (.). > 6: All digits after Excess Megabytes billed at: including a period (.). > > Would this be the best way of going about this? If so where do I start my $text = <
Re: Creating a string with quotes and delimiters from an Array
Angus Laycock wrote: > > Hi, Hello, > I have an array > @array = qw(alf bert charlie 4) > > and I want a string that contains this value < > 'alf','bert','charlie','4' > with the single quotes and commas. > > I know I can do this $string = join ( ',' , @array); > which gives me this > < one|two|three|four> but how > do I get the single quotes around each word. > > Also, how can I check if one of the values is numeric so > I dont put quotes around it? So the result is like this > ---> < 'alf','bert','charlie',4 > my @array = qw(alf bert charlie 4 -3 0 6.43 -9.234); my $string; { local $^W; # turn off warnings $string = join ',', map { $_ eq $_ + 0 ? $_ : "'$_'" } @array; } print "$string\n"; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regex...
I would probably do something like: my $file; my %values; # open the text file and read in all contents (eliminate new lines) #elided for space # now search my @patterns( "Pre-paid hours", "Hours used so far", "Excess hours billed at", ... ); foreach( @patterns ) { if( $file =~ /$_:\s+\$?(\d+(\.\d+)?)/ ) { $values{$_} = $1; } else { die "Could not find $_\n"; } } What this does is search for the patterns listed in the @pattens array followed by a colon and spaces an optional $, followed by digits and an optional fractional part. It then will store the numbers in a hash that is indexed by the pattern...so you could say print $values{"Pre-paid hours"}; and it would print 744 Tanton - Original Message - From: "Daniel Falkenberg" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 6:15 PM Subject: Regex... > Hey all, > > I am just working on a small text file and was wondering if a regular > expression would help me here. Basically the text file looks like > this... > > User data query User data query Time utilization for this billing period > Pre-paid hours: 744 Hours used so far: 29.55 Excess hours billed at: > $1.00 per hour Traffic utilization for this billing period Pre-paid > megabytes: 500 Megabytes used so far: 60.52 Excess Megabytes billed > at: $0.18 per Megabyte > > Now I want to extract the following... > > 1: All digits after Pre-paid hours: including a period (.). > > 2: All digits after Hours user so far: including a period (.). > > 3: All digits after Excess Hours billed at: including a period (.). > > 4: All digits after Pre-paid megabytes: including a period (.). > > 5: All digits after Used so far: including a period (.). > > 6: All digits after Excess Megabytes billed at: including a period (.). > > Would this be the best way of going about this? If so where do I start > :) > > Regards, > > Dan > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
I'll try this in the morning. Thanks Gus - Original Message - From: Timothy Johnson <[EMAIL PROTECTED]> To: Timothy Johnson <[EMAIL PROTECTED]>; 'Angus Laycock' <[EMAIL PROTECTED]>; Tanton Gibbs <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 11:11 PM Subject: RE: Creating a string with quotes and delimiters from an Array > > I guess I should have put this: !~ /^[-+]{0,1}\d+(.\d+){0,1}$/ since > there's really no time that you will need more than one positive or negative > in one number. > > -Original Message- > From: Timothy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 27, 2002 3:05 PM > To: 'Angus Laycock'; Tanton Gibbs; [EMAIL PROTECTED] > Subject: RE: Creating a string with quotes and delimiters from an Array > > > > maybe you can replace =~ /\D/ with "!~ /^[-+]?\d+(.\d+){0,1}$/" *whew* > > which means "does not equal: > >start with zero or more - or + # ^[-+]? >followed by one or more digits # \d+ >followed by zero or one sets of a period followed by one or more digits > at the end of the string # (.\d+){0,1}$ > > -Original Message- > From: Angus Laycock [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 26, 2002 10:41 AM > To: Tanton Gibbs; [EMAIL PROTECTED] > Subject: Re: Creating a string with quotes and delimiters from an Array > > > What about on negative numbers like -1? They come up with quotes, any ideas? > > Thanks > > Gus > - Original Message - > From: Tanton Gibbs <[EMAIL PROTECTED]> > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, February 27, 2002 10:53 PM > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > I apologize for not stating it earlier...mea culpa (and if I didn't have > the > > time, I shouldn't post to the beginners list anyway!) > > > > the ? : operator is like an if else statement > > if actually expands to (sort of) > > > > if( /\D/ ) { > > $string .= "'$_',"; > > } > > else { > > $string .= "$_,"; > > } > > > > The regular expression /\D/ matches anything that is not a digit. Since > we > > do not provide a variable for it to operate on, it chooses the default > > variable $_ which is set by the preceeding foreach loop. The .= is the > > string concatenation operator with assignment...it actually expands to > > $string = $string . "'$_',"; > > > > Hope this helps! > > Tanton > > - Original Message - > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, February 26, 2002 1:33 PM > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > I know I now have the result but how does it do it? > > > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > > > If you have the time. > > > > > > Thanks again > > > > > > Gus > > > > > > > > > - Original Message - > > > From: Tanton Gibbs <[EMAIL PROTECTED]> > > > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Wednesday, February 27, 2002 10:30 PM > > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > > > > Your best bet is to do this with a foreach loop > > > > > > > > my $string = ''; > > > > my @array = qw( alf bert charlie 4 ) > > > > foreach( @array ) { > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > } > > > > - Original Message - > > > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Tuesday, February 26, 2002 1:07 PM > > > > Subject: Creating a string with quotes and delimiters from an Array > > > > > > > > > > > > Hi, > > > > > > > > I have an array > @array = qw(alf bert charlie 4) > > > > > > > > and I want a string that contains this value < > > 'alf','bert','charlie','4' > > > > > > > > with the single quotes and commas. > > > > > > > > I know I can do this $string = join ( ',' , @array); which gives me > > > > this > < one|two|three|four> but how do I get the single quotes > > around > > > > each word. > > > > > > > > > > > > Also, how can I check if one of the values is numeric so I dont put > > quotes > > > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > > > > > > > > Thanks > > > > > > > > > > > > Gus > > > > > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- -- > > This email may contain confidential and privileged > material for the sole use of the intended recipient. > If you are not the intended recipient, please contact > the sender and delete all copies. > > -- > To unsubscribe, e-mail: [EMAIL
Re: Creating a string with quotes and delimiters from an Array
Michael, Well spotted on the database question. I am trying to handle parameters from UNIX that call a PERL script the uses DBI, that then calls Sybase stored procedures. The problem I have found is that they don't pass the strings with single quotes and dates are 02-27-02, again without quotes. So I tried to quote them but found that they pass some numbers as well for "int" datatypes and some are negative and some are positive. The only thing left is to try and access syscolumns in Sybase and try and work out what the parameters are and then add quotes or leave them out. I thought I would try with the option of not quoting numbers. It is a total headblower and I don't have much time. Gus - Original Message - From: Michael Fowler <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 11:14 PM Subject: Re: Creating a string with quotes and delimiters from an Array > On Tue, Feb 26, 2002 at 06:07:33PM -, Angus Laycock wrote: > > I have an array > @array = qw(alf bert charlie 4) > > > > and I want a string that contains this value < 'alf','bert','charlie','4' > > > with the single quotes and commas. > > $str = join(',', map { "'$_'" } @array); > > > > Also, how can I check if one of the values is numeric so I dont put quotes > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > $str = join(',', map { /\D/ ? "'$_'" : $_ } @array); > > "value is numeric" is a little vague; I went with a regex that's simple, but > won't catch quite a few variations. See perldoc -q 'is a number' for > alternatives. > > > By the way, what is this for? It looks suspiciously like you're using it > for database inserts or something along those lines; there are better > alternatives if that is the case. > > > Michael > -- > Administrator www.shoebox.net > Programmer, System Administrator www.gallanttech.com > -- > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating a string with quotes and delimiters from an Array
I guess I should have put this: !~ /^[-+]{0,1}\d+(.\d+){0,1}$/ since there's really no time that you will need more than one positive or negative in one number. -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 3:05 PM To: 'Angus Laycock'; Tanton Gibbs; [EMAIL PROTECTED] Subject: RE: Creating a string with quotes and delimiters from an Array maybe you can replace =~ /\D/ with "!~ /^[-+]?\d+(.\d+){0,1}$/" *whew* which means "does not equal: start with zero or more - or + # ^[-+]? followed by one or more digits # \d+ followed by zero or one sets of a period followed by one or more digits at the end of the string # (.\d+){0,1}$ -Original Message- From: Angus Laycock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 10:41 AM To: Tanton Gibbs; [EMAIL PROTECTED] Subject: Re: Creating a string with quotes and delimiters from an Array What about on negative numbers like -1? They come up with quotes, any ideas? Thanks Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:53 PM Subject: Re: Creating a string with quotes and delimiters from an Array > I apologize for not stating it earlier...mea culpa (and if I didn't have the > time, I shouldn't post to the beginners list anyway!) > > the ? : operator is like an if else statement > if actually expands to (sort of) > > if( /\D/ ) { > $string .= "'$_',"; > } > else { > $string .= "$_,"; > } > > The regular expression /\D/ matches anything that is not a digit. Since we > do not provide a variable for it to operate on, it chooses the default > variable $_ which is set by the preceeding foreach loop. The .= is the > string concatenation operator with assignment...it actually expands to > $string = $string . "'$_',"; > > Hope this helps! > Tanton > - Original Message - > From: "Angus Laycock" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 26, 2002 1:33 PM > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > I know I now have the result but how does it do it? > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > If you have the time. > > > > Thanks again > > > > Gus > > > > > > - Original Message - > > From: Tanton Gibbs <[EMAIL PROTECTED]> > > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Wednesday, February 27, 2002 10:30 PM > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > Your best bet is to do this with a foreach loop > > > > > > my $string = ''; > > > my @array = qw( alf bert charlie 4 ) > > > foreach( @array ) { > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > } > > > - Original Message - > > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Tuesday, February 26, 2002 1:07 PM > > > Subject: Creating a string with quotes and delimiters from an Array > > > > > > > > > Hi, > > > > > > I have an array > @array = qw(alf bert charlie 4) > > > > > > and I want a string that contains this value < > 'alf','bert','charlie','4' > > > > > > with the single quotes and commas. > > > > > > I know I can do this $string = join ( ',' , @array); which gives me > > > this > < one|two|three|four> but how do I get the single quotes > around > > > each word. > > > > > > > > > Also, how can I check if one of the values is numeric so I dont put > quotes > > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > > > > > Thanks > > > > > > > > > Gus > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regex...
Hey all, I am just working on a small text file and was wondering if a regular expression would help me here. Basically the text file looks like this... User data query User data query Time utilization for this billing period Pre-paid hours: 744 Hours used so far: 29.55 Excess hours billed at: $1.00 per hour Traffic utilization for this billing period Pre-paid megabytes: 500 Megabytes used so far: 60.52 Excess Megabytes billed at: $0.18 per Megabyte Now I want to extract the following... 1: All digits after Pre-paid hours: including a period (.). 2: All digits after Hours user so far: including a period (.). 3: All digits after Excess Hours billed at: including a period (.). 4: All digits after Pre-paid megabytes: including a period (.). 5: All digits after Used so far: including a period (.). 6: All digits after Excess Megabytes billed at: including a period (.). Would this be the best way of going about this? If so where do I start :) Regards, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
On Tue, Feb 26, 2002 at 06:07:33PM -, Angus Laycock wrote: > I have an array > @array = qw(alf bert charlie 4) > > and I want a string that contains this value < 'alf','bert','charlie','4' > > with the single quotes and commas. $str = join(',', map { "'$_'" } @array); > Also, how can I check if one of the values is numeric so I dont put quotes > around it? So the result is like this ---> < 'alf','bert','charlie',4 > $str = join(',', map { /\D/ ? "'$_'" : $_ } @array); "value is numeric" is a little vague; I went with a regex that's simple, but won't catch quite a few variations. See perldoc -q 'is a number' for alternatives. By the way, what is this for? It looks suspiciously like you're using it for database inserts or something along those lines; there are better alternatives if that is the case. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating a string with quotes and delimiters from an Array
maybe you can replace =~ /\D/ with "!~ /^[-+]?\d+(.\d+){0,1}$/" *whew* which means "does not equal: start with zero or more - or + # ^[-+]? followed by one or more digits # \d+ followed by zero or one sets of a period followed by one or more digits at the end of the string # (.\d+){0,1}$ -Original Message- From: Angus Laycock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 10:41 AM To: Tanton Gibbs; [EMAIL PROTECTED] Subject: Re: Creating a string with quotes and delimiters from an Array What about on negative numbers like -1? They come up with quotes, any ideas? Thanks Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:53 PM Subject: Re: Creating a string with quotes and delimiters from an Array > I apologize for not stating it earlier...mea culpa (and if I didn't have the > time, I shouldn't post to the beginners list anyway!) > > the ? : operator is like an if else statement > if actually expands to (sort of) > > if( /\D/ ) { > $string .= "'$_',"; > } > else { > $string .= "$_,"; > } > > The regular expression /\D/ matches anything that is not a digit. Since we > do not provide a variable for it to operate on, it chooses the default > variable $_ which is set by the preceeding foreach loop. The .= is the > string concatenation operator with assignment...it actually expands to > $string = $string . "'$_',"; > > Hope this helps! > Tanton > - Original Message - > From: "Angus Laycock" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 26, 2002 1:33 PM > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > I know I now have the result but how does it do it? > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > If you have the time. > > > > Thanks again > > > > Gus > > > > > > - Original Message - > > From: Tanton Gibbs <[EMAIL PROTECTED]> > > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Wednesday, February 27, 2002 10:30 PM > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > Your best bet is to do this with a foreach loop > > > > > > my $string = ''; > > > my @array = qw( alf bert charlie 4 ) > > > foreach( @array ) { > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > } > > > - Original Message - > > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Tuesday, February 26, 2002 1:07 PM > > > Subject: Creating a string with quotes and delimiters from an Array > > > > > > > > > Hi, > > > > > > I have an array > @array = qw(alf bert charlie 4) > > > > > > and I want a string that contains this value < > 'alf','bert','charlie','4' > > > > > > with the single quotes and commas. > > > > > > I know I can do this $string = join ( ',' , @array); which gives me > > > this > < one|two|three|four> but how do I get the single quotes > around > > > each word. > > > > > > > > > Also, how can I check if one of the values is numeric so I dont put > quotes > > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > > > > > Thanks > > > > > > > > > Gus > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suidperl -- how to??
Gary [[EMAIL PROTECTED]] quoth: *>You also might want to consider using a c-wrapper. In this case a c-wrapper *>is a c program that call's your perl script. You compile that program and *>make the resulting executable setuid. This is a more secure (albeit slightly) *>way to do setuid with perl (or any interpreted language for that matter). For *>implementation details see 'perldoc perlsec' on your system. It really depends on what you're doing with it and the solaris kernel isn't thought to be vulnerable to the older security bugs with suidperl. Common sense is the best guide. Also, a slight omission from the original message I sent; *>> sh ./Configure -ders *>> *>> make make suidperl *>> make test *>> make install e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
Ah, that is a horse of a different colour. We need to define the types of numbers you might have and how lenient you are willing to get...for instance, can you have data such as 1.3e2 1-3 (number or not?) The solution depends on your input data set. - Original Message - From: "Angus Laycock" <[EMAIL PROTECTED]> To: "Tanton Gibbs" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, February 26, 2002 1:41 PM Subject: Re: Creating a string with quotes and delimiters from an Array > What about on negative numbers like -1? They come up with quotes, any ideas? > > Thanks > > Gus > - Original Message - > From: Tanton Gibbs <[EMAIL PROTECTED]> > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, February 27, 2002 10:53 PM > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > I apologize for not stating it earlier...mea culpa (and if I didn't have > the > > time, I shouldn't post to the beginners list anyway!) > > > > the ? : operator is like an if else statement > > if actually expands to (sort of) > > > > if( /\D/ ) { > > $string .= "'$_',"; > > } > > else { > > $string .= "$_,"; > > } > > > > The regular expression /\D/ matches anything that is not a digit. Since > we > > do not provide a variable for it to operate on, it chooses the default > > variable $_ which is set by the preceeding foreach loop. The .= is the > > string concatenation operator with assignment...it actually expands to > > $string = $string . "'$_',"; > > > > Hope this helps! > > Tanton > > - Original Message - > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, February 26, 2002 1:33 PM > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > I know I now have the result but how does it do it? > > > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > > > If you have the time. > > > > > > Thanks again > > > > > > Gus > > > > > > > > > - Original Message - > > > From: Tanton Gibbs <[EMAIL PROTECTED]> > > > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Wednesday, February 27, 2002 10:30 PM > > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > > > > Your best bet is to do this with a foreach loop > > > > > > > > my $string = ''; > > > > my @array = qw( alf bert charlie 4 ) > > > > foreach( @array ) { > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > } > > > > - Original Message - > > > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Tuesday, February 26, 2002 1:07 PM > > > > Subject: Creating a string with quotes and delimiters from an Array > > > > > > > > > > > > Hi, > > > > > > > > I have an array > @array = qw(alf bert charlie 4) > > > > > > > > and I want a string that contains this value < > > 'alf','bert','charlie','4' > > > > > > > > with the single quotes and commas. > > > > > > > > I know I can do this $string = join ( ',' , @array); which gives me > > > > this > < one|two|three|four> but how do I get the single quotes > > around > > > > each word. > > > > > > > > > > > > Also, how can I check if one of the values is numeric so I dont put > > quotes > > > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > > > > > > > > Thanks > > > > > > > > > > > > Gus > > > > > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating a string with quotes and delimiters from an Array
In english, it says: $string .= "append the result of the following expression to $string" /D/ ? "'$_'," : "$_,"; "if 'there are no non-digits'(/D/) is true, then return the default variable ($_) with quotes around it followed by a comma, otherwise return the default variable followed by a comma without quotes" In mine, I used /^\d+$/, which means "if it has only digits from the start (^) to the finish ($)" note: if there is a newline in the string at the end, then you might end up returning the newline, too, but for the most part this works. -Original Message- From: Angus Laycock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 10:33 AM To: [EMAIL PROTECTED] Subject: Re: Creating a string with quotes and delimiters from an Array I know I now have the result but how does it do it? $string .= /\D/ ? "'$_'," : "$_,"; If you have the time. Thanks again Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:30 PM Subject: Re: Creating a string with quotes and delimiters from an Array > Your best bet is to do this with a foreach loop > > my $string = ''; > my @array = qw( alf bert charlie 4 ) > foreach( @array ) { > $string .= /\D/ ? "'$_'," : "$_,"; > } > - Original Message - > From: "Angus Laycock" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 26, 2002 1:07 PM > Subject: Creating a string with quotes and delimiters from an Array > > > Hi, > > I have an array > @array = qw(alf bert charlie 4) > > and I want a string that contains this value < 'alf','bert','charlie','4' > > with the single quotes and commas. > > I know I can do this $string = join ( ',' , @array); which gives me > this > < one|two|three|four> but how do I get the single quotes around > each word. > > > Also, how can I check if one of the values is numeric so I dont put quotes > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > Thanks > > > Gus > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
What about on negative numbers like -1? They come up with quotes, any ideas? Thanks Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:53 PM Subject: Re: Creating a string with quotes and delimiters from an Array > I apologize for not stating it earlier...mea culpa (and if I didn't have the > time, I shouldn't post to the beginners list anyway!) > > the ? : operator is like an if else statement > if actually expands to (sort of) > > if( /\D/ ) { > $string .= "'$_',"; > } > else { > $string .= "$_,"; > } > > The regular expression /\D/ matches anything that is not a digit. Since we > do not provide a variable for it to operate on, it chooses the default > variable $_ which is set by the preceeding foreach loop. The .= is the > string concatenation operator with assignment...it actually expands to > $string = $string . "'$_',"; > > Hope this helps! > Tanton > - Original Message - > From: "Angus Laycock" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 26, 2002 1:33 PM > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > I know I now have the result but how does it do it? > > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > > If you have the time. > > > > Thanks again > > > > Gus > > > > > > - Original Message - > > From: Tanton Gibbs <[EMAIL PROTECTED]> > > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Wednesday, February 27, 2002 10:30 PM > > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > > > > Your best bet is to do this with a foreach loop > > > > > > my $string = ''; > > > my @array = qw( alf bert charlie 4 ) > > > foreach( @array ) { > > > $string .= /\D/ ? "'$_'," : "$_,"; > > > } > > > - Original Message - > > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Tuesday, February 26, 2002 1:07 PM > > > Subject: Creating a string with quotes and delimiters from an Array > > > > > > > > > Hi, > > > > > > I have an array > @array = qw(alf bert charlie 4) > > > > > > and I want a string that contains this value < > 'alf','bert','charlie','4' > > > > > > with the single quotes and commas. > > > > > > I know I can do this $string = join ( ',' , @array); which gives me > > > this > < one|two|three|four> but how do I get the single quotes > around > > > each word. > > > > > > > > > Also, how can I check if one of the values is numeric so I dont put > quotes > > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > > > > > Thanks > > > > > > > > > Gus > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
I apologize for not stating it earlier...mea culpa (and if I didn't have the time, I shouldn't post to the beginners list anyway!) the ? : operator is like an if else statement if actually expands to (sort of) if( /\D/ ) { $string .= "'$_',"; } else { $string .= "$_,"; } The regular expression /\D/ matches anything that is not a digit. Since we do not provide a variable for it to operate on, it chooses the default variable $_ which is set by the preceeding foreach loop. The .= is the string concatenation operator with assignment...it actually expands to $string = $string . "'$_',"; Hope this helps! Tanton - Original Message - From: "Angus Laycock" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 26, 2002 1:33 PM Subject: Re: Creating a string with quotes and delimiters from an Array > I know I now have the result but how does it do it? > > $string .= /\D/ ? "'$_'," : "$_,"; > > If you have the time. > > Thanks again > > Gus > > > - Original Message - > From: Tanton Gibbs <[EMAIL PROTECTED]> > To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, February 27, 2002 10:30 PM > Subject: Re: Creating a string with quotes and delimiters from an Array > > > > Your best bet is to do this with a foreach loop > > > > my $string = ''; > > my @array = qw( alf bert charlie 4 ) > > foreach( @array ) { > > $string .= /\D/ ? "'$_'," : "$_,"; > > } > > - Original Message - > > From: "Angus Laycock" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, February 26, 2002 1:07 PM > > Subject: Creating a string with quotes and delimiters from an Array > > > > > > Hi, > > > > I have an array > @array = qw(alf bert charlie 4) > > > > and I want a string that contains this value < 'alf','bert','charlie','4' > > > > with the single quotes and commas. > > > > I know I can do this $string = join ( ',' , @array); which gives me > > this > < one|two|three|four> but how do I get the single quotes around > > each word. > > > > > > Also, how can I check if one of the values is numeric so I dont put quotes > > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > > > Thanks > > > > > > Gus > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
I know I now have the result but how does it do it? $string .= /\D/ ? "'$_'," : "$_,"; If you have the time. Thanks again Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:30 PM Subject: Re: Creating a string with quotes and delimiters from an Array > Your best bet is to do this with a foreach loop > > my $string = ''; > my @array = qw( alf bert charlie 4 ) > foreach( @array ) { > $string .= /\D/ ? "'$_'," : "$_,"; > } > - Original Message - > From: "Angus Laycock" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 26, 2002 1:07 PM > Subject: Creating a string with quotes and delimiters from an Array > > > Hi, > > I have an array > @array = qw(alf bert charlie 4) > > and I want a string that contains this value < 'alf','bert','charlie','4' > > with the single quotes and commas. > > I know I can do this $string = join ( ',' , @array); which gives me > this > < one|two|three|four> but how do I get the single quotes around > each word. > > > Also, how can I check if one of the values is numeric so I dont put quotes > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > Thanks > > > Gus > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
die handler
Hi , I have this in my code : local $SIG{__DIE__} = \&die_handler; and then sub die_handler { my (@vars)=@_; print STDERR "\nfirst : " . $vars[0]; print STDERR "\nsecond : " . $vars[1]; } if i give : die ('goo','foo','bar'); Then I get the output : first : goofoobar at out.pl line 233. second : I want to have the three arguments in an array. can somebody tell what am I doing wrong ? Thanks Pradeep _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
Tanton, Cheers. I stuck a chop in at the end and got the results. 'alf','bert','charlie',4 Thanks to you both Cheers again Gus - Original Message - From: Tanton Gibbs <[EMAIL PROTECTED]> To: Angus Laycock <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:30 PM Subject: Re: Creating a string with quotes and delimiters from an Array > Your best bet is to do this with a foreach loop > > my $string = ''; > my @array = qw( alf bert charlie 4 ) > foreach( @array ) { > $string .= /\D/ ? "'$_'," : "$_,"; > } > - Original Message - > From: "Angus Laycock" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 26, 2002 1:07 PM > Subject: Creating a string with quotes and delimiters from an Array > > > Hi, > > I have an array > @array = qw(alf bert charlie 4) > > and I want a string that contains this value < 'alf','bert','charlie','4' > > with the single quotes and commas. > > I know I can do this $string = join ( ',' , @array); which gives me > this > < one|two|three|four> but how do I get the single quotes around > each word. > > > Also, how can I check if one of the values is numeric so I dont put quotes > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > Thanks > > > Gus > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
Tim, Here are the results from @array = qw(one two three 4); 'one','two','three' 'one','two','three''one','two','three',4 Pretty close on the second one. Your first one certainly sorted it for the strings. Thanks Gus - Original Message - From: Timothy Johnson <[EMAIL PROTECTED]> To: 'Angus Laycock' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 10:24 PM Subject: RE: Creating a string with quotes and delimiters from an Array > > Oops. I meant: > > foreach(@array){ >if($_ !~ /^\d+$/){ > $scalar .= "\'$_\',"; # append the variable surrounded by single > quotes >}else{ > $scalar .= "$_,"; >} > } > chop scalar; #get rid of the last comma > > > -Original Message- > From: Timothy Johnson > Sent: Wednesday, February 27, 2002 2:23 PM > To: 'Angus Laycock'; [EMAIL PROTECTED] > Subject: RE: Creating a string with quotes and delimiters from an Array > > > > You could try something like this: > > foreach(@array){ >unless($_ =~ /^\d+$/){ > $scalar .= "\'$_\',"; # append the variable surrounded by single > quotes >} > } > chop scalar; #get rid of the last comma > > It's a little messy, but it should work. > > -Original Message- > From: Angus Laycock [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 26, 2002 10:08 AM > To: [EMAIL PROTECTED] > Subject: Creating a string with quotes and delimiters from an Array > > > Hi, > > I have an array > @array = qw(alf bert charlie 4) > > and I want a string that contains this value < 'alf','bert','charlie','4' > > with the single quotes and commas. > > I know I can do this $string = join ( ',' , @array); which gives me this > > < one|two|three|four> but how do I get the single quotes around each > word. > > > Also, how can I check if one of the values is numeric so I dont put quotes > around it? So the result is like this ---> < 'alf','bert','charlie',4 > > > Thanks > > > Gus > > > -- -- > This email may contain confidential and privileged > material for the sole use of the intended recipient. > If you are not the intended recipient, please contact > the sender and delete all copies. > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating a string with quotes and delimiters from an Array
Your best bet is to do this with a foreach loop my $string = ''; my @array = qw( alf bert charlie 4 ) foreach( @array ) { $string .= /\D/ ? "'$_'," : "$_,"; } - Original Message - From: "Angus Laycock" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 26, 2002 1:07 PM Subject: Creating a string with quotes and delimiters from an Array Hi, I have an array > @array = qw(alf bert charlie 4) and I want a string that contains this value < 'alf','bert','charlie','4' > with the single quotes and commas. I know I can do this $string = join ( ',' , @array); which gives me this > < one|two|three|four> but how do I get the single quotes around each word. Also, how can I check if one of the values is numeric so I dont put quotes around it? So the result is like this ---> < 'alf','bert','charlie',4 > Thanks Gus -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating a string with quotes and delimiters from an Array
Oops. I meant: foreach(@array){ if($_ !~ /^\d+$/){ $scalar .= "\'$_\',"; # append the variable surrounded by single quotes }else{ $scalar .= "$_,"; } } chop scalar; #get rid of the last comma -Original Message- From: Timothy Johnson Sent: Wednesday, February 27, 2002 2:23 PM To: 'Angus Laycock'; [EMAIL PROTECTED] Subject: RE: Creating a string with quotes and delimiters from an Array You could try something like this: foreach(@array){ unless($_ =~ /^\d+$/){ $scalar .= "\'$_\',"; # append the variable surrounded by single quotes } } chop scalar; #get rid of the last comma It's a little messy, but it should work. -Original Message- From: Angus Laycock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 10:08 AM To: [EMAIL PROTECTED] Subject: Creating a string with quotes and delimiters from an Array Hi, I have an array > @array = qw(alf bert charlie 4) and I want a string that contains this value < 'alf','bert','charlie','4' > with the single quotes and commas. I know I can do this $string = join ( ',' , @array); which gives me this > < one|two|three|four> but how do I get the single quotes around each word. Also, how can I check if one of the values is numeric so I dont put quotes around it? So the result is like this ---> < 'alf','bert','charlie',4 > Thanks Gus This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating a string with quotes and delimiters from an Array
You could try something like this: foreach(@array){ unless($_ =~ /^\d+$/){ $scalar .= "\'$_\',"; # append the variable surrounded by single quotes } } chop scalar; #get rid of the last comma It's a little messy, but it should work. -Original Message- From: Angus Laycock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 10:08 AM To: [EMAIL PROTECTED] Subject: Creating a string with quotes and delimiters from an Array Hi, I have an array > @array = qw(alf bert charlie 4) and I want a string that contains this value < 'alf','bert','charlie','4' > with the single quotes and commas. I know I can do this $string = join ( ',' , @array); which gives me this > < one|two|three|four> but how do I get the single quotes around each word. Also, how can I check if one of the values is numeric so I dont put quotes around it? So the result is like this ---> < 'alf','bert','charlie',4 > Thanks Gus This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: asin?
On Wed, Feb 27, 2002 at 03:53:46PM -0600, Jerry Preston wrote: > Does Perl support asin? If so, what, where, when and an example. Someone on the list probably knows what you're talking about, but so that others may help you would you please elaborate? Describe where you've seen this construct before, what it does, and give us some examples on its use. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Creating a string with quotes and delimiters from an Array
Hi, I have an array > @array = qw(alf bert charlie 4) and I want a string that contains this value < 'alf','bert','charlie','4' > with the single quotes and commas. I know I can do this $string = join ( ',' , @array); which gives me this > < one|two|three|four> but how do I get the single quotes around each word. Also, how can I check if one of the values is numeric so I dont put quotes around it? So the result is like this ---> < 'alf','bert','charlie',4 > Thanks Gus
Re: Installing perl
Nikola Janceski [[EMAIL PROTECTED]] quoth: *>actually you want 5.6.1 (stable release) you can find it on perl.com at *>http://perl.com/pub/a/language/info/software.html http://www.cpan.org/src/ is the appropriate and correct address to refer people to when they are looking for the perl source code and http://www.cpan.org/ports/ when they are looking for binaries. *>there should be release notes, but there are many bug fixes and new *>functionality added, nothing spectacular, but if you knew the differences *>between Perl4 and Perl5 this is half as much of a change. All source distributions have 'Changes' to detail the new features as well as the perldelta.pod. And the changes between 5.6.0 and 5.6.1 can be seen by doing 'perldoc perldelta' under the surprisingly obfuscated header "Summary of changes between 5.6.0 and 5.6.1" at the very top. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Seeking HTTP module
Try this as a base to get the data use strict; use LWP::Simple; my $add="http://www.worldofcgi.com/process.cgi?term1=hello&term2=world";; ## after ? are gets my $content = get($add); print $content; Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: "Chuck Tomasi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 2:02 PM Subject: Seeking HTTP module > I suspect there is something out there to do what I need, but I'm not > quite sure what to look for. I was hoping this would be a more efficient > way of asking... > > Setup: Apache 1.3.x, Perl 5.6.0, Sun Solaris 2.7. > > I need to write a CGI program that makes an HTTP connection (port 80) and > does a GET from a remote server. > > My particular case is to call a Perl CGI on server A that does a GET > (calls a CGI) on server B so that it looks like server A has the data. In > reality, the first CGI is DEFANGded in a server side include (SSI) so it > can't make the call to server B's CGI directly. I've got a buddy who has > done this in PHP, and I know it can be done in Perl. > > HTML Doc --> call local CGI --> HTTP GET --> remote CGI runs > > output appears as inline text in original HTML document. > > Thanks. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looping Code ?
You might want to post more code if this isn't what you're asking, but you could try something like this: @files = ('file1','file2'); foreach $file(@files){ open(INFILE,$file); while(){ if($_ =~ /^AR/){ $arTotal++; }elsif($_ =~ /^ACCT/){ $accTotal++; } } close INFILE; } print "I found AR $arTotal times, and ACCT $accTotal times.\n"; By the way, I think that when you want to assign the value of an increment, you should do it like this: $total = ++$count;, otherwise I think you pass the current value and then increment the variable. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 1:14 PM To: Perl Beg Subject: Looping Code ? What I am trying to do is get a total of line that matches a specific criteria and when it stops matching return the total to variable. If I have the following files: file1: file2: $line[1] = $field[0] AR AR AR ACCT AR ACCT ACCT ACCT ACCT and use the following: if ($line[1] = (/^:$field[0]/)) { $total = $count++;} I want $total for AR to = 3 and $total for ACCT = 4. When I run it I get 1 2 3 3 3 3 3 1 2 3 4 4 4 4 4 4 etc... Any thoughts Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Seeking HTTP module
I suspect there is something out there to do what I need, but I'm not quite sure what to look for. I was hoping this would be a more efficient way of asking... Setup: Apache 1.3.x, Perl 5.6.0, Sun Solaris 2.7. I need to write a CGI program that makes an HTTP connection (port 80) and does a GET from a remote server. My particular case is to call a Perl CGI on server A that does a GET (calls a CGI) on server B so that it looks like server A has the data. In reality, the first CGI is embedded in a server side include (SSI) so it can't make the call to server B's CGI directly. I've got a buddy who has done this in PHP, and I know it can be done in Perl. HTML Doc --> call local CGI --> HTTP GET --> remote CGI runs output appears as inline text in original HTML document. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suidperl -- how to??
You also might want to consider using a c-wrapper. In this case a c-wrapper is a c program that call's your perl script. You compile that program and make the resulting executable setuid. This is a more secure (albeit slightly) way to do setuid with perl (or any interpreted language for that matter). For implementation details see 'perldoc perlsec' on your system. Gary Elaine -HFB- Ashton wrote: > Ansh Kanwar [[EMAIL PROTECTED]] quoth: > *> > *>I am trying to compile a program which needs suidperl. What option do I > *>specify while compiling from source so that suidperl can be built? > *> > *>I am compiling stable-5.6.1 on a Solaris 8 machine. > > sh ./Configure -ders > > make > make test > make install > > I would highly recommend reading the perlsec manpage as suidperl can create > bigger problems than the ones it solves. > > e. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Gary EbertManager Network Operations Voice: (301) 428-2100 X2115 Comtech Mobile Datacom Corporation Fax: (301) 428-1004 19540 Amaranth Drive Mobile:(301) 332-4930 Germantown, MD 20875-2126 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: asin?
On Feb 27, Jerry Preston said: >Does Perl support asin? If so, what, where, when and an example. Use the POSIX module for asin(). use POSIX 'asin'; $x = asin(...); -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perl question
Allison Ogle [[EMAIL PROTECTED]] quoth: *> *>I am a beginner trying to write a program which will read information from a *>log file and write it to a spreadsheet for easier viewing and organization *>but I'm not sure how to do this or how to get started. ANY help would be *>appreciatd. Please respond to [EMAIL PROTECTED] Thanks so much, http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlopentut.html is a place to start. Perl comes with a buttload of documentation and there are a lot of books out there as well to get you started. It is much easier to answer a specific question than to ask an incredibly broad question that a book would do a better job of answering. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
asin?
Hey, Does Perl support asin? If so, what, where, when and an example. Thanks, Jerry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looping Code ?
[EMAIL PROTECTED] wrote: > > What I am trying to do is get a total of line that > matches a specific criteria and when it stops matching > return the total to variable. If I have the following > files: > file1: file2: > $line[1] = $field[0] > AR AR > AR ACCT > AR > ACCT > ACCT > ACCT > ACCT > > and use the following: > if ($line[1] = (/^:$field[0]/)) { > $total = $count++;} > > I want $total for AR to = 3 and $total for ACCT = 4. > > When I run it I get > 1 > 4 etc... Here is one way to do it: #!/usr/bin/perl -w use strict; open F, '< file2' or die "Cannot open file2: $!"; my %fields = map { chomp; $_, 0 } ; close F; open F, '< file1' or die "Cannot open file1: $!"; while ( ) { chomp; $fields{$_}++ if exists $fields{$_}; } close F; print "$_ = $fields{$_}\n" for keys %fields; __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suidperl -- how to??
Ansh Kanwar [[EMAIL PROTECTED]] quoth: *> *>I am trying to compile a program which needs suidperl. What option do I *>specify while compiling from source so that suidperl can be built? *> *>I am compiling stable-5.6.1 on a Solaris 8 machine. sh ./Configure -ders make make test make install I would highly recommend reading the perlsec manpage as suidperl can create bigger problems than the ones it solves. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help with simple menus
Tim Lago wrote: > > I have this perl script that works for what I need to do with it except for > the menus. I am new to perl and I have found out that I can download menu > modules that can do what I want, but I am looking for a simpler solution. > > Ok, the question I have is this, can I create a simple menu that allows for > the user to select from a pre defined section of choices, 1-5, and how would > I do this. What I have done with the first two choices doesn't work, it > always defaults to the first choice. > > Anyway help would be greatly appreciated it. > > #!/perl/bin Enabling warnings would have caught your error. #!/perl/bin -w use strict; > [snip code] > > if ($choice = 1){ ^ You are assigning the value 1 to the variable $choice. if ( $choice == 1 ) { > while(){ > if(/10.1.1.234/){ > print OUTFILE; > $count++; > } > } > } > > elsif ($choice = 2){ ^ > while(){ > if(/10.1.2.234/) { > print OUTFILE; > $count++; > } > } > } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reading a file line by line
Jon Serra wrote: > > Greetings, I am trying to read a text file into a scalar variable line by line > until EOF or a search test if fullfilled. I have been reading files in like > this: > > chomp (@line = `cat filename`); > > I do not want to do this beacuse my file is quite large, and there is no reason > to hog the memory for the little bit I actually want, and second, I do not want > to make a system call to the unix cat command. TIA Jon open IN, '< filename' or die "Cannot open filename: $!"; while ( ) { chomp; # do something with current line } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Looping Code ?
What I am trying to do is get a total of line that matches a specific criteria and when it stops matching return the total to variable. If I have the following files: file1: file2: $line[1] = $field[0] AR AR AR ACCT AR ACCT ACCT ACCT ACCT and use the following: if ($line[1] = (/^:$field[0]/)) { $total = $count++;} I want $total for AR to = 3 and $total for ACCT = 4. When I run it I get 1 2 3 3 3 3 3 1 2 3 4 4 4 4 4 4 etc... Any thoughts Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help to delete a line
Joanne Fearon wrote: > > Hi, Hello, > I have a file that I am chopping and changing. I want to delete line 12 > each time. I have a counter to tell the line number. Ive tried > > if ($counter == 12) > { > next; > } > $counter++ > > this doesn't give an error but doesnt move on to the next line either. If you are reading from a file then the variable $. will contain the current line number (explained in the perlvar document.) while ( ) { next if $. == 12; # do other stuff } If you want to use your own counter then: my $counter; while ( ) { next if ++$counter == 12; # do other stuff } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: iteration default variable
Michael Kavanagh wrote: > > Hi there, Hello, > This is probably a simple one... > > in a loop like this: > > for (@answer) { > #do something ... > } > > I understand that for each iteration of the loop, $_ contains the value of > $answer[current iteration]. > But is there a default variable I can use to get the current index value? No, Perl doesn't provide a variable for this but it is fairly easy to do. for my $iterator ( 0 .. $#answer ) { #do something with $answer[$iterator] } Or you can use the C style of for loop. for ( my $iterator = 0; $iterator < @answer; ++$iterator ) { #do something with $answer[$iterator] } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: perl2exe
yes I believe you should have cygwin installed anyway... :) mL - Original Message - From: "Agustin Rivera" <[EMAIL PROTECTED]> To: "Craig Williams" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 12:44 PM Subject: Re: perl2exe > You might be able to run a script written for *nix if you have Cygwin > installed and run it from there. > > Agustin Rivera > Webmaster, Pollstar.com > http://www.pollstar.com > > > > - Original Message - > From: "Craig Williams" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 27, 2002 12:02 PM > Subject: perl2exe > > > > Does anyone know - will perl2exe (or a different package to create an > ..exe) > > allow a perl script to be launched from windows explorer EVEN THOUGH the > > script is written for unix (and is sitting on a unix netowrk drive)? > > > > I have many perl scripts my users would find useful but all written to run > > on unix (Sun). I've a large number of users who have neither the rights, > > permissions, desire, or know-how to execute a perl script from a unix > > prompt. So I'm tasked with coddling these windoze people. I'd like to > allow > > them to simply "double click" the .exe which launches the perl script. > > > > I'd like to avoid any additional installations of perl. Idea's? > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: perl2exe
You might be able to run a script written for *nix if you have Cygwin installed and run it from there. Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: "Craig Williams" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 27, 2002 12:02 PM Subject: perl2exe > Does anyone know - will perl2exe (or a different package to create an ..exe) > allow a perl script to be launched from windows explorer EVEN THOUGH the > script is written for unix (and is sitting on a unix netowrk drive)? > > I have many perl scripts my users would find useful but all written to run > on unix (Sun). I've a large number of users who have neither the rights, > permissions, desire, or know-how to execute a perl script from a unix > prompt. So I'm tasked with coddling these windoze people. I'd like to allow > them to simply "double click" the .exe which launches the perl script. > > I'd like to avoid any additional installations of perl. Idea's? > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Printing lines after a designed matching line!
Thuy Tran wrote: > > Hi all, Hello, > I would like to prints a specified number of lines from a file that after > any line match a specified regular expression (ex. UID) > > open(FILE, 'data' ) or die "can't open"; > if start ! = UID > skip line; > else > read 100 lines below UID > end if > > __data__ > Nov 2002 Page 1 > > UID CPU_PRIME #SESSION > 0 20 > 1 30 > .. open FILE, 'data' or die "can't open 'data': $!"; my ( $start, $end ); while ( ) { $start = $. + 1, $end = $. + 101 if /UID/; print if $. == $start .. $. == $end; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Don´t know how to install Perl
Sorry, for the other send. Thought I had one email and replied incorrectly. Wags ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 12:26 To: Anna & Tobias Lindstedt Cc: Perl Subject: Re: Don´t know how to install Perl Basically, if you have the windows installer (InstMsiA.exe), all you need is to download ActivePerl, and double-click on the downloaded file (through My Computer icon). For details, go to this site: http://www.activestate.com/Products/Download/Get.plex?id=ActivePerl and click on "next", then :next" __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Don´t know how to install Perl
Yes. Wags ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 12:26 To: Anna & Tobias Lindstedt Cc: Perl Subject: Re: Don´t know how to install Perl Basically, if you have the windows installer (InstMsiA.exe), all you need is to download ActivePerl, and double-click on the downloaded file (through My Computer icon). For details, go to this site: http://www.activestate.com/Products/Download/Get.plex?id=ActivePerl and click on "next", then :next" __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help with simple menus
In your if: 'if ($choice = 1){' (in reality for all equality checks) you really want = to be == . What you are doing is assigning 1 to $choice and if true do what is in the block. Since 1 is non-zero you have a true condition. Wags ;) -Original Message- From: Tim Lago [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 12:02 To: [EMAIL PROTECTED] Subject: Help with simple menus I have this perl script that works for what I need to do with it except for the menus. I am new to perl and I have found out that I can download menu modules that can do what I want, but I am looking for a simpler solution. Ok, the question I have is this, can I create a simple menu that allows for the user to select from a pre defined section of choices, 1-5, and how would I do this. What I have done with the first two choices doesn't work, it always defaults to the first choice. Anyway help would be greatly appreciated it. #!/perl/bin #This allows the user to choose the Access log of the Real Media Server print "Enter the name of the Real Media Access Log:\n"; print "\n"; chomp($infile = ); open(INFILE, "$infile") or die "Can't open the Real LOG!: $!"; open(OUTFILE, ">outfile.1") or die "Can't create outfile.txt: $!"; print "Enter name of the Real Media file; \n"; print "\n"; chomp($realname = ); $counter = 0; while() { if(/$realname/) { print OUTFILE; $counter++; } } print "$counter matches \n"; print "\n"; # This section allows the user to choose the type of connection that was made to the Real Media File print "Choose the type of connection:\n\n"; print "1- Proxy Server: Site 1, 10.1.1.234 \n\n"; print "2- Proxy Server: Site 2, 10.1.2.234 \n\n"; print "3- Proxy Server: Site 3, 10.1.3.234 \n\n"; print "4- Proxy Server: Site 4, 10.1.3.234 \n\n"; print "5- All Proxy Servers \n\n"; print "6- All Non Proxy Connections \n\n"; chomp($choice = ); open(INFILE, "outfile.1") or die "Can't open input file!: $!"; open(OUTFILE, ">outfile.2") or die "Can't create out put file!: $!"; $count = 0; if ($choice = 1){ while(){ if(/10.1.1.234/){ print OUTFILE; $count++; } } } elsif ($choice = 2){ while(){ if(/10.1.2.234/) { print OUTFILE; $count++; } } } print "$realname was accessed on choice $choice, $count times. \n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: perl2exe
From: Craig Williams <[EMAIL PROTECTED]> > Does anyone know - will perl2exe (or a different package to create an .exe) > allow a perl script to be launched from windows explorer EVEN THOUGH the > script is written for unix (and is sitting on a unix netowrk drive)? Well ... 1) The place where it sits is irrelevant as long as the users can access it. 2) The fact that the script was written for unix could matter. If it calls some external tools that are not available on windows you'll either have to modify the script or install windows versions of those tools. Also if the script makes asumptions on paths (like /usr/bin, /dev/nul, etc) you'll have to change it. But usualy it's doable and often not hard. > I have many perl scripts my users would find useful but all written to run > on unix (Sun). I've a large number of users who have neither the rights, > permissions, desire, or know-how to execute a perl script from a unix > prompt. So I'm tasked with coddling these windoze people. I'd like to allow > them to simply "double click" the .exe which launches the perl script. > > I'd like to avoid any additional installations of perl. Idea's? You'll have to have at least one instalation of Perl on a windows system (WinNT/Win2k/WinXP preferably). Cause perl2exe will not run under Unix and the versions of PerlApp that run under Unix will not be able to create Windows EXEcutables. So you need on Windows machine with Perl to test the scripts and compile them. Good luck :-) Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Don´t know how to install Perl
Basically, if you have the windows installer (InstMsiA.exe), all you need is to download ActivePerl, and double-click on the downloaded file (through My Computer icon). For details, go to this site: http://www.activestate.com/Products/Download/Get.plex?id=ActivePerl and click on "next", then :next" __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: reading a file line by line
Here's something simple: open(FILE, "/export/home/me/filename"); while ($line = ) { # whatever } FILE is a filehandle, and by defualt it will give you back a line at a time. You can also put the whole thing into an array by doing this: @file = ; At least, I think that's it. Somebody correct me if I'm wrong. -Original Message- From: Jon Serra [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 11:58 AM To: [EMAIL PROTECTED] Subject: reading a file line by line Greetings, I am trying to read a text file into a scalar variable line by line until EOF or a search test if fullfilled. I have been reading files in like this: chomp (@line = `cat filename`); I do not want to do this beacuse my file is quite large, and there is no reason to hog the memory for the little bit I actually want, and second, I do not want to make a system call to the unix cat command. TIA Jon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
perl2exe
Does anyone know - will perl2exe (or a different package to create an .exe) allow a perl script to be launched from windows explorer EVEN THOUGH the script is written for unix (and is sitting on a unix netowrk drive)? I have many perl scripts my users would find useful but all written to run on unix (Sun). I've a large number of users who have neither the rights, permissions, desire, or know-how to execute a perl script from a unix prompt. So I'm tasked with coddling these windoze people. I'd like to allow them to simply "double click" the .exe which launches the perl script. I'd like to avoid any additional installations of perl. Idea's? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reading a file line by line
On Wed, 27 Feb 2002, Jon Serra wrote: > Greetings, I am trying to read a text file into a scalar variable line by line > until EOF or a search test if fullfilled. I have been reading files in like > this: > > chomp (@line = `cat filename`); > > I do not want to do this beacuse my file is quite large, and there is no reason > to hog the memory for the little bit I actually want, and second, I do not want > to make a system call to the unix cat command. TIA Jon The canonical way to read data from a file in Perl is: open FHANDLE, "<$filename" or die "Can't open $filename: $!\n"; while() { chomp; #do stuff with $_ } close FHANDLE; See the perldoc on the open function. -- Brett http://www.chapelperilous.net/ "An entire fraternity of strapping Wall-Street-bound youth. Hell - this is going to be a blood bath!" -- Post Bros. Comics -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help with simple menus
I have this perl script that works for what I need to do with it except for the menus. I am new to perl and I have found out that I can download menu modules that can do what I want, but I am looking for a simpler solution. Ok, the question I have is this, can I create a simple menu that allows for the user to select from a pre defined section of choices, 1-5, and how would I do this. What I have done with the first two choices doesn't work, it always defaults to the first choice. Anyway help would be greatly appreciated it. #!/perl/bin #This allows the user to choose the Access log of the Real Media Server print "Enter the name of the Real Media Access Log:\n"; print "\n"; chomp($infile = ); open(INFILE, "$infile") or die "Can't open the Real LOG!: $!"; open(OUTFILE, ">outfile.1") or die "Can't create outfile.txt: $!"; print "Enter name of the Real Media file; \n"; print "\n"; chomp($realname = ); $counter = 0; while() { if(/$realname/) { print OUTFILE; $counter++; } } print "$counter matches \n"; print "\n"; # This section allows the user to choose the type of connection that was made to the Real Media File print "Choose the type of connection:\n\n"; print "1- Proxy Server: Site 1, 10.1.1.234 \n\n"; print "2- Proxy Server: Site 2, 10.1.2.234 \n\n"; print "3- Proxy Server: Site 3, 10.1.3.234 \n\n"; print "4- Proxy Server: Site 4, 10.1.3.234 \n\n"; print "5- All Proxy Servers \n\n"; print "6- All Non Proxy Connections \n\n"; chomp($choice = ); open(INFILE, "outfile.1") or die "Can't open input file!: $!"; open(OUTFILE, ">outfile.2") or die "Can't create out put file!: $!"; $count = 0; if ($choice = 1){ while(){ if(/10.1.1.234/){ print OUTFILE; $count++; } } } elsif ($choice = 2){ while(){ if(/10.1.2.234/) { print OUTFILE; $count++; } } } print "$realname was accessed on choice $choice, $count times. \n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reading a file line by line
Greetings, I am trying to read a text file into a scalar variable line by line until EOF or a search test if fullfilled. I have been reading files in like this: chomp (@line = `cat filename`); I do not want to do this beacuse my file is quite large, and there is no reason to hog the memory for the little bit I actually want, and second, I do not want to make a system call to the unix cat command. TIA Jon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Don´t know how to install Perl
Hey! Iám totaly new to perl and and don´t understand how to install perl to a computer with windows 98 and my DOS 6.22 computer. Can sombody tell me in a simple way so I can start learn Perl Many Thanks from Toby -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unable to Create MAPI Session
> When I try to create a MAPI Session I am getting the following error > > Win32::OLE(0.1502) error 0x800401f3: "Invalid class string" > > Please suggest... > > Thanks in advance. > > Pathi > > Here is the code I have: > > # Create a new MAPI Session > use Win32::OLE; > $Win32::OLE::Warn=2 ;#Always warn with verbose error messages > $session = Win32::OLE->new("MAPI.Session") or die "Could not create a > new MAPI Session: $!"; > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Changing Lines per page? $=
$= = 60; #this is the default $= = $page_length; #is what you want -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 1:53 PM To: [EMAIL PROTECTED] Subject: Changing Lines per page? $= I know it is possible to change the number of lines per page using $=. Can this be changed using a variable such as $=$page_length and if so where do you place this in your code? Any help is greatly appreciated. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Changing Lines per page? $=
I know it is possible to change the number of lines per page using $=. Can this be changed using a variable such as $=$page_length and if so where do you place this in your code? Any help is greatly appreciated. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DBI related question (I think)
I have a CGI script which is giving me a "::Connection: Close " string on the resultant web page when used against my production environment, but does not against my QA environment.Does anyone have any idea what could be causing this? I have tried pointing the production program to the QA db - does nothing. The source starts with : : Connection: Close When responding, please cc to either of my email addresses below, as I do not have newsgroup access at the office. Thanks Carlin Anderson Sr. Software Engineer APL Direct Logistics 1301 Riverplace Blvd, Suite 530 Jacksonville, FL 32207 904-858-4754 direct 904-616-6542 cell phone, pager [EMAIL PROTECTED] [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
bootable cd with perl on it
Hi, This group has been such a source of perl learning for me, that I thought I would share this. I found this useful little method of putting my entire perl5 lib and scripts on a bootable cdrom. I thought some of you might like to create one yourself. With a bit of ingenuity, you can also get ppp support going by copying pppd and chat into the BINARIES. This will boot, have perl ready to run, and have Midnight Commander. This is for linux systems, but the mkcdrec utility can be setup for windows, that's up to you. Go to: http://freshmeat.net/projects/mkcdrec/ and download mkCDrec_v0.6.0.tar.gz then follow these additional instructions. 1. Untar the package and cd to the mkcdrec directory. 2. mkdir 'utilities' 3. copy the entire /usr/lib/perl5 directory to mkcdrec/utilities/perl5 4. Edit the Config.sh at(or near) line 325 where a section called 'Links=' is started. Add a link like this: /usr/lib=perl5=/cdrom/utilities/perl5 5. You can copy as many of your utilities as you want to this utilities directory, and make links. However, it is easier to do the next step. 6. Goto Config.sh around line 224 where the section called 'Binaries=' begins. Just add entries there, like: perl perldoc mycoolscript.pl etc etc. This ends the perl part of the setup. 7. Goto the beginning of Config.sh and edit each entry to suit your system. For certain, specify LINUX_KERNEL that you wish to use. Like:'/boot/vmlinuz.suse-2.4.4-4GB' BURNCDR=y SCSIDEVICE='0,1,0' ( or whatever you use for your system ) (cdrecord -scanbus will tell you) etc, etc,etc Don't ignore the line for DEVFS=0 , the cd won't boot if you set this wrong. Set it to 1 only if your kernel supports it. 8. Finally do a 'make test' to see how your Config.sh looks. If all is well, do a 'make'; select option 1 (Rescue CD), and your cd will be made. 9. Boot it, and start mc, I'm sure you can take it from there. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cygwin/activestate/linux
On Wed, 27 Feb 2002, Tyler Cruickshank wrote: > Ive been using perl for a year or so on various platforms (Sun/UNIX, > linux, NT-cygwin, Active State). Do people recommend ActiveState over > cygwin for the NT system - how about ActiveState on Linux? Not being a > "system" guru Id like to use the simplist environment on which to add > modules and run perl. Any thoughts? Thanks. I prefer the cygwin Perl myself on NT/2k, because I can easily grab stuff from CPAN and build the modules as needed, just like I can under Unix, without needing VC++ & nmake, and the system calls act more like they do under Unix. Of course, I don't think you can use CygWin's Perl with IIS or even Apache (unless you build Apache under Cygwin), but I don't do web stuff under Windows, so it isn't crucial there. Never used ActiveState under Linux, so I can't speak for that. Most version of Linux (and for that matter, most recent versions of any flavor of Unix, including Solaris) now come standard with Perl, so I've never needed to install anything other than to upgrade to the next version. -- Brett http://www.chapelperilous.net/ Think lucky. If you fall in a pond, check your pockets for fish. -- Darrell Royal -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Installing perl
actually you want 5.6.1 (stable release) you can find it on perl.com at http://perl.com/pub/a/language/info/software.html there should be release notes, but there are many bug fixes and new functionality added, nothing spectacular, but if you knew the differences between Perl4 and Perl5 this is half as much of a change. -Original Message- From: Leon, Yanet I,,DMDCWEST [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 12:55 PM To: '[EMAIL PROTECTED]' Subject: Installing perl I have perl 5.005_03 currently installed on my systems. What are the benefits (if any) for upgrading it to the latest version (5.6.0)? Where can I get a free copy of perl 5.6.0? Is it easy to compile? Please let me know. Regards, Yanet -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cygwin/activestate/linux
Hi, I hope this question isnt too ridiculous. Ive been using perl for a year or so on various platforms (Sun/UNIX, linux, NT-cygwin, Active State). Do people recommend ActiveState over cygwin for the NT system - how about ActiveState on Linux? Not being a "system" guru Id like to use the simplist environment on which to add modules and run perl. Any thoughts? Thanks. -tyler -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Installing perl
I have perl 5.005_03 currently installed on my systems. What are the benefits (if any) for upgrading it to the latest version (5.6.0)? Where can I get a free copy of perl 5.6.0? Is it easy to compile? Please let me know. Regards, Yanet -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help to delete a line
You need to increment the counter *inside* that block as well. Otherwise, $counter will remain 12 and you will go into an infinite loop. if ($counter == 12) { $counter++ next; } $counter++; HTH John -Original Message- From: Joanne Fearon [mailto:[EMAIL PROTECTED]] Sent: 27 February 2002 17:20 To: [EMAIL PROTECTED] Subject: help to delete a line Hi, I have a file that I am chopping and changing. I want to delete line 12 each time. I have a counter to tell the line number. Ive tried if ($counter == 12) { next; } $counter++ this doesn't give an error but doesnt move on to the next line either. thanks in advance for any help Jo. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help to delete a line
Hi, I have a file that I am chopping and changing. I want to delete line 12 each time. I have a counter to tell the line number. Ive tried if ($counter == 12) { next; } $counter++ this doesn't give an error but doesnt move on to the next line either. thanks in advance for any help Jo. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing a windows directory
My problem is when the $search variable is used in the search_file subroutine. The code works fine if I change Active Logos 600 dpi to Active_Logos_600_dpi. I don't recall which perl book this code began life as, but here it is: #! /usr/bin/perl -w use strict; use CGI qw(:standard); use File::Basename; my $dir = "D:\\Inetpub\\wwwroot\\kfvstart\\intranet\\Eric\\Logos\\Active Logos 600 dpi\\"; my $criteria; my $search; my $files; my $counter = '0'; print header; print start_html (-title=>'Logo Search', -bgcolor=>'#ff'); if(param('criteria') ) { search_file(); } else { display_menu(); } print end_html; sub search_file { $criteria = param('criteria'); $search = $dir . $criteria; print ""; print "Search Results"; print ''; print ''; while ($files = <$search*>) { $counter++; $files =~ s#.*/##; #remove part before last slash my ($name, $directory, $extension) = fileparse($files,'\..*'); my $filename = $name . $extension; my $uri = "http://wv1svlg001/Active%20Logos%20600%20dpi/"; . $filename; if ($counter % 2) { print ''; } else { print ''; } print "$filename"; print ''; } print ''; my $home = "http://wvweb/Eric/imagesearch.pl";; print ""; print "Search Again\n"; print ""; } sub display_menu { print start_form, b,('Search for logo '), p, p,('Enter Customer Number:'), p, textfield(-name=>'criteria'), p, submit(-name=>'Search'), end_form; } Any suggestions for improvement will be appreciated. Thanks, Eric -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file names with spaces in perl
From: "Johnson, Shaunn" <[EMAIL PROTECTED]> > --Yeah, I did cut and past, but I missed > the backticks at the beginning and > end of the command (mkisofs) and > the end of the line. No problem, just wanted to be sure. > --The readdir option - not sure if I follow, > but I will look for something about readdir > instead of `ls -1` for what I have to. Oooops ... now I think I do know what the problem is. Could you try to chomp($cmd) ? If you assign the backticks to an array, then all the items of that array end with a newline. That's why I don't fully believe that the output looked right if you printed instead off executed the commands. And that's also one of the reasons why I think for $cmd (glob "$report_dir/*") { would be better. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No access to /etc/protocols
> "Paul" == Paul Murphy <[EMAIL PROTECTED]> writes: Paul> Hello everyone. Paul> My ISP doesn't have /etc/protocols world readable, and so IO::Socket Paul> doesn't work, as getprotobyname and getprotobynumber fail. Time to get a new ISP, unless you can clue them in that this file is necessary. ISPs are a dime a dozen these days, so doing stoopid tricks like this is just a way of saying "we don't want any clueful users". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Trouble with Net::Ping
I am appearing to have some troubles. Here is what I have for my code: #!/usr/bin/perl -w use strict; use Net::Ping; Initalize Variables# my @hosts= qw(au); my $t; my @lines; my $hostname; my %status; #while(1){ $t = Net::Ping->new(); foreach $hostname (@hosts) { if ($t->ping("ad.$hostname.doubleclick.net") ) { $status{$hostname} = " is alive.\n"; print "This connection is alive.\n"; }else { $status{$hostname} = "*** NOT PINGABLE!! PLEASE CHECK!!***\n"; print "Thing connection is have problems."; } $t->close(); } &emailstatus(%status) The code goes on and I know that works but this part is where I am having the troubles. Can someone maybe point me in the right direction. Thanks, Joseph Bajin Associate Systems Administrator -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file names with spaces in perl
--Sorry 'bout that: --Yeah, I did cut and past, but I missed the backticks at the beginning and end of the command (mkisofs) and the end of the line. --The readdir option - not sure if I follow, but I will look for something about readdir instead of `ls -1` for what I have to. --But what I don't get is, when I did a print of the dir, it looked okay ... why can't I capture the entire file (or, list) in a variable? Maybe I missed that entirely ... someone was telling me to try to use double quotes for that ... but I haven't gotten it to work ... --Thanks! -X -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 11:32 AM To: [EMAIL PROTECTED] Subject: Re: file names with spaces in perl From: "Johnson, Shaunn" <[EMAIL PROTECTED]> > I'm having a problem with trying to get > a list of files with spaces in them. > > I'm writing a perl script that goes into > a directory, get a list of files with spaces > in them (this is a file.doc) and run a > mkisofs command against it. > > I can get a list of the files: > > [example] > > $debug=2; > foreach $cmd (`ls -1 $report_dir`) > > [/example] > > This *looks* like it gives me what i want (a list > of directories that have spaces in them, but > when i try something like this: Please don't shell out (start external processes) unless you have to. Use readdir or glob instead! > [example] > > { > $mkisofs -f -J -r -hide-joliet-trans-tbl -V 'Report' -T -v -o > '$iso_dir/$cmd.iso' "$report_dir"; > } > __END__ > [/example] print the command instead of executing it, Maybe you'll notice what the problem is. Also ... I don't see any system(), backticks or whatever in your code, didn't you copy&pasted the real code into your post? Jenda
Sorting a hash table - Advanced;)
Hi all, ok here is the fundamental code print "\n\n**Summary**\n"; foreach my $key (keys %runset){ printf ( "%-20s %-20s\n",$key, $runset{$key}); } Now I want to sort this hash for example print "\n\n**Summary**\n"; foreach my $key (keys %runset){ print "Name $runset{foo}" # .. other specific keys printf ( "%-20s %-20s\n",$key, $runset{$key}); } The question is how can I sort the remaining keys that I haven't already printed before. Basically I want to format this so certain keys get printed in a certain order, but there may be some remaining keys that I want printed that I really don't care about. (a "catch-all" if you will) Thanks -- Steven M. Klass Physical Design Manager National Semiconductor Corp 7400 W. Detroit Street Suite 170 Chandler AZ 85226 Ph:480-753-2503 Fax:480-705-6407 [EMAIL PROTECTED] http://www.nsc.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file names with spaces in perl
From: "Johnson, Shaunn" <[EMAIL PROTECTED]> > I'm having a problem with trying to get > a list of files with spaces in them. > > I'm writing a perl script that goes into > a directory, get a list of files with spaces > in them (this is a file.doc) and run a > mkisofs command against it. > > I can get a list of the files: > > [example] > > $debug=2; > foreach $cmd (`ls -1 $report_dir`) > > [/example] > > This *looks* like it gives me what i want (a list > of directories that have spaces in them, but > when i try something like this: Please don't shell out (start external processes) unless you have to. Use readdir or glob instead! > [example] > > { > $mkisofs -f -J -r -hide-joliet-trans-tbl -V 'Report' -T -v -o > '$iso_dir/$cmd.iso' "$report_dir"; > } > __END__ > [/example] print the command instead of executing it, Maybe you'll notice what the problem is. Also ... I don't see any system(), backticks or whatever in your code, didn't you copy&pasted the real code into your post? Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: iteration default variable
I don't think there is one. You can maintain a counter for this purpose though. my $counter; for (@answer) { #do something ... print "On element index $counter\n"; $counter++; } John (Ex OUP...) -Original Message- From: KAVANAGH, Michael [mailto:[EMAIL PROTECTED]] Sent: 27 February 2002 16:26 To: '[EMAIL PROTECTED]' Subject: iteration default variable Hi there, This is probably a simple one... in a loop like this: for (@answer) { #do something ... } I understand that for each iteration of the loop, $_ contains the value of $answer[current iteration]. But is there a default variable I can use to get the current index value? Can't seem to find the answer anywhere... any ideas would be helpful. Thanks everybody for contributing to this list... I find it useful. Thanks Mike Kavanagh -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iteration default variable
Hi there, This is probably a simple one... in a loop like this: for (@answer) { #do something ... } I understand that for each iteration of the loop, $_ contains the value of $answer[current iteration]. But is there a default variable I can use to get the current index value? Can't seem to find the answer anywhere... any ideas would be helpful. Thanks everybody for contributing to this list... I find it useful. Thanks Mike Kavanagh -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problems installing GD
Here's what I've done: - Compiled and installed libpng, libjpg, libz, and libfreetype (2.0.8) (all successfully) - Compiled and installed gd-1.8.4 sucessfully. GD-1.3.8 configures and makes successfully, but when i make test, it fails test #8 (I believe 8 is the freetype test). It doesn't give any reasons why it failed the test. I tried backing down freetype to version 2.0.7, and GD to 1.37, with the same result. I also tried doing all this on my linux box with the same result, so I don't think it's the perl installation. TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file names with spaces in perl
Howdy: I'm having a problem with trying to get a list of files with spaces in them. I'm writing a perl script that goes into a directory, get a list of files with spaces in them (this is a file.doc) and run a mkisofs command against it. I can get a list of the files: [example] $debug=2; foreach $cmd (`ls -1 $report_dir`) [/example] This *looks* like it gives me what i want (a list of directories that have spaces in them, but when i try something like this: [example] { $mkisofs -f -J -r -hide-joliet-trans-tbl -V 'Report' -T -v -o '$iso_dir/$cmd.iso' "$report_dir"; } __END__ [/example] I get more errors that look like this: [errors] /usr/bin/mkisofs: No such file or directory. Invalid node - /s/Profiling2/report/03/IHC0047 + /usr/bin/mkisofs -f -J -r -hide-joliet-trans-tbl -V Reports -T -v -o /s/Profiling2/iso/03/JACKSON.iso /s/Profiling2/report/03/JACKSON [/errors] The first part (No such file or directory) I believe is about the not being comleted. The full name of the file is still chopped up and give me errors. My question: How can I capture the ENTIRE file / directory name and use that variable when I execute my commands? (Sorry this seems to be a long email) Thanks! -X
Re: accessing a windows directory
From: Eric Peers <[EMAIL PROTECTED]> Send reply to: [EMAIL PROTECTED] To: <[EMAIL PROTECTED]> Subject:accessing a windows directory Date sent: Wed, 27 Feb 2002 07:52:50 -0800 > I'm writing a simple file search program to run on a Windows machine > and am having trouble accessing a directory with spaces in the path > name. For example: my $dir = "D:\\Images\\Active Images 600 dpi\\" What do you mean by "accessing"? There is no problem opening files in directories with spaces in the names, you should only have to care if you execute an external program. Please show us some example. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
accessing a windows directory
I'm writing a simple file search program to run on a Windows machine and am having trouble accessing a directory with spaces in the path name. For example: my $dir = "D:\\Images\\Active Images 600 dpi\\" I have not found a way for perl to use this directory without stopping at the spaces. Encasing the 'Active Images 600 dpi' in quotes causes a compile error, so I'm not certain where to go with perl. I can supply the full code if needed. Thanks, Eric -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Net::Telnet perl modules
Hi I am trying to install "Net::Telnet" perl modules on linux redhat 7.1 kernel 2.4.2. but i get this error when i run "make install" : PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.6.1/i386-linux -I/usr/lib/perl5/5.6.1 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t t/selectFAILED test 3 Failed 1/3 tests, 66.67% okay Failed Test Status Wstat Total Fail Failed List of Failed t/select.t 31 33.33% 3 Failed 1/1 test scripts, 0.00% okay. 1/3 subtests failed, 66.67% okay. make: *** [test_dynamic] Error 29 Do you have any suggestion ? Thanks in advance behnaz Shirazi
RE: Perl help
I have a script that I can send you which writes data from the NT eventlog files into an Exel spreadsheet. I think this post belongs in the Perl Beginners list, so I'm mailing it there. Please post back to the list with your replies. John -Original Message- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: 27 February 2002 14:55 To: John Edwards Subject: RE: Perl help The log file is actually a *.dat file and I would be writing it to an Excel spreadsheet. I am on a Windows 2000 operating system. You'll have to forgive me because I don't know anything yet about Perl and I really need help getting started. Any help would be so greatly appreciated. -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 9:42 AM To: 'Allison Ogle'; [EMAIL PROTECTED] Subject: RE: Perl help What format log file? What format spreadsheet? What OS? -Original Message- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: 27 February 2002 14:42 To: [EMAIL PROTECTED] Subject: Perl help Hi, I am a beginner trying to write a program which will read information from a log file and write it to a spreadsheet for easier viewing and organization but I'm not sure how to do this or how to get started. ANY help would be appreciatd. Please respond to [EMAIL PROTECTED] Thanks so much, Allison -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Printing lines after a designed matching line!
Hi all, I would like to prints a specified number of lines from a file that after any line match a specified regular expression (ex. UID) open(FILE, 'data' ) or die "can't open"; if start ! = UID skip line; else read 100 lines below UID end if __data__ Nov 2002 Page 1 UID CPU_PRIME #SESSION 0 20 1 30 ... Nov 2002 Page 2 Thank you so much for helping me. Thuy Tran -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: =head1 ?? -Huh
> Can you guys clue me in to what this means? =head1 DESCRIPTION These tags belong to Perl's documentation markup language which is embedded in Perl programs. =cut > How do I use it, and why would I use it? perldoc perlpod Cause the users have a right to have man pages :) Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: =head1 ?? -Huh
On Wed, 27 Feb 2002, Steven M. Klass wrote: > Can you guys clue me in to what this means? > > How do I use it, and why would I use it? perldoc perlpod -- Brett http://www.chapelperilous.net/ One good turn deserves another. -- Gaius Petronius -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
=head1 ?? -Huh
Hi all, Can you guys clue me in to what this means? How do I use it, and why would I use it? Thanks -- Steven M. Klass Physical Design Manager National Semiconductor Corp 7400 W. Detroit Street Suite 170 Chandler AZ 85226 Ph:480-753-2503 Fax:480-705-6407 [EMAIL PROTECTED] http://www.nsc.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: No access to /etc/protocols
From: "Paul Murphy" <[EMAIL PROTECTED]> > Is there a particular way I have to implement this? I have the > following code but it runs the normal getproto rather than my one. > > -- > #/bin/perl -w > You have to put a BEGIN{} block around the subroutine definition and "instalation: BEGIN { sub my_getprotobyname { print "hello\n"; } *CORE::GLOBAL::getprotobyname = \&my_getprotobyname; } print "Going to function\n"; my @test = getprotobyname("tcp"); print @test; Sorry I forgot about that before (I've always did things like this in a module's import() function which is called within execution of use statements which means it behaves kind of as if it was in a BEGIN{} block.) The reason is ... you have to replace the function BEFORE perl parses and compiles the calls to it. I guess it would be best to put the functions into a module and replace the core functions in an import : package Fake::Getprotos; sub my_getprotobyname { print "hello\n"; } ... sub import { *CORE::GLOBAL::getprotobyname = \&my_getprotobyname; ... } 1; Just make sure that module is the first to be used. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: No access to /etc/protocols
Thanks Jenda. Is there a particular way I have to implement this? I have the following code but it runs the normal getproto rather than my one. -- #/bin/perl -w sub my_getprotobyname { print "hello"; } *CORE::GLOBAL::getprotobyname = \&my_getprotobyname; print "Going to function\n"; my @test = getprotobyname("tcp"); print @test; - Jenda said: What about "replacing" the builtin getprotobyname() and getprotobynum() functions: sub my_getprotobyname { ... } *CORE::GLOBAL::getprotobyname = \&my_getprotobyname; That looks like the easiest (even though dirty of course) solution. (Not tested). Jenda _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Matching
Iain Wallace wrote: > > Hi, Hello, > I was wondering if any one can help me. Is there any > command in perl that will let me match a line only if the next line > fufills a certain condition, without doing a double loop over the file? > My data is like this > > Variable1 number number number > Variable1 number number number --- want this line > Variable2 number number number --- and this > Variable2 number number number > > Does any one have any ideas ? open FILE, 'some_file' or die "Cannot open some_file: $!"; my $prev_line = ; while ( ) { if ( /certain condition/ ) { print "$prev_line$_"; } $prev_line = $_; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reg Exp help
Thanks Daryl & 'Japhy' for your suggestions. I ended up using: $Out = `$Cmd` ; $Out =~ /^\|GRP\|\s*(.*)/m ; The data I want ends up in $1. -Original Message- From: Busse, Rich Sent: Tuesday, 26 February, 2002 09:35 To: Perl Beginners Subject: Reg Exp help I am capturing the output of a command in a string: $Out = `$Cmd` ; The output always looks like: List of Templates and Template Groups assigned to 'somenode.us.dnb.com': |GRP| SBS-DSM Operation successfully completed. It's always on 5 separate lines. How do I extract what follows |GRP| on the third line to a variable? TIA... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Matching
>> On 27/2/02 13:11, "Jon Molin" <[EMAIL PROTECTED]> wrote: >> >> >> Hi, >> >> I was wondering if any one can help me. Is there any command in perl that >> will let me match a line only if the next line >> fufills a certain condition, without doing a double loop over the file? >> My data is like this >> >> Variable1 number number number >> Variable1 number number number --- want this line >> Variable2 number number number --- and this >> Variable2 number number number > > I'm pretty new to perl myself, but: > > #!/usr/bin/perl -w > use strict; > use warnings; > > my $variable1 = "line1 \n line2"; > print "$1\n" if $variable1 =~ /(.+)["\n"]\sline.+/; The regex could probably be simplified: if $variable1 =~ /[\n]\s/; Where is what you would want to be matched for in the second line of $variable1. -- T. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Matching
On 27/2/02 13:11, "Jon Molin" <[EMAIL PROTECTED]> wrote: > Iain Wallace wrote: >> >> Hi, >> >> I was wondering if any one can help me. Is there any command in perl that >> will let me match a line only if the next line >> fufills a certain condition, without doing a double loop over the file? >> My data is like this >> >> Variable1 number number number >> Variable1 number number number --- want this line >> Variable2 number number number --- and this >> Variable2 number number number I'm pretty new to perl myself, but: #!/usr/bin/perl -w use strict; use warnings; my $variable1 = "line1 \n line2"; print "$1\n" if $variable1 =~ /(.+)["\n"]\sline.+/; This is a pretty quick and dirty script that somehow does this. It doesn't really work that nice, but I guess that would work? It prints the first line of $variable1, if the second line of $variable one has line in it. -- T. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Matching
Iain Wallace wrote: > > Hi, > > I was wondering if any one can help me. Is there any command in perl that will let >me match a line only if the next line > fufills a certain condition, without doing a double loop over the file? > My data is like this > > Variable1 number number number > Variable1 number number number --- want this line > Variable2 number number number --- and this > Variable2 number number number > > Does any one have any ideas ? if you match with //s, (treat string as single line) you can do it with regexp (see 'perldoc perlre') otherwise, if you have the data in an array: my @content = ; close (FILE); for (my $i = 0; $i <= $#content; $i++) { if ($i < $#content && $content[$i] =~ /^Variable1 && $content[$i + 1] =~ /^Variable2/) { do stuff } } /jon > Thanks very much > > Iain -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Matching
Hi, I was wondering if any one can help me. Is there any command in perl that will let me match a line only if the next line fufills a certain condition, without doing a double loop over the file? My data is like this Variable1 number number number Variable1 number number number --- want this line Variable2 number number number --- and this Variable2 number number number Does any one have any ideas ? Thanks very much Iain
Perl inetd auth server on AIX4.2
Hi all, I'm trying to write an inetd service in perl to run on an AIX 4.2 system that will accept a username/password, and then return a true/false/error response based on whether the user exists and whether the password is correct. What is the best method for the perl app the check the password. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No access to /etc/protocols
From: "Paul Murphy" <[EMAIL PROTECTED]> > My ISP doesn't have /etc/protocols world readable, and so IO::Socket > doesn't work, as getprotobyname and getprotobynumber fail. > > I am using the Mail::POP3Client wrapper. > > I am trying to come up with a workaround, and the best I can come up > with is a horrendous hack to IO::Socket::INET so that it knows that > tcp is protocol 6 and vice versa. > > My ideal would be to store a local copy of /etc/protocols for Perl, > and somehow fool it into resolving there rather then the real one. > > Does anyone have any tips? I can't modify anything too fundamental > with Perl, as I am running their binary. What about "replacing" the builtin getprotobyname() and getprotobynum() functions: sub my_getprotobyname { ... } *CORE::GLOBAL::getprotobyname = \&my_getprotobyname; That looks like the easiest (even though dirty of course) solution. (Not tested). Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
No access to /etc/protocols
Hello everyone. My ISP doesn't have /etc/protocols world readable, and so IO::Socket doesn't work, as getprotobyname and getprotobynumber fail. I am using the Mail::POP3Client wrapper. I am trying to come up with a workaround, and the best I can come up with is a horrendous hack to IO::Socket::INET so that it knows that tcp is protocol 6 and vice versa. My ideal would be to store a local copy of /etc/protocols for Perl, and somehow fool it into resolving there rather then the real one. Does anyone have any tips? I can't modify anything too fundamental with Perl, as I am running their binary. Paul. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Beginner question
Frank 'Olorin' Rizzi wrote: >Hello everybody. > >I am just starting with Perl, >so the following question will probably appear simple to most of you. > >I am trying to get a Perl program to provide me with a listing of the files >stored on the machine (where the program runs). >The environment is a Win machine.. > >Say I have something like the following: > >#!/usr/bin/perl > >use File::Find; >use Win32API::File ":ALL"; > >foreach (getLogicalDrives()) > { > my $dir = $_; > > next unless (GetDriveType($_) == DRIVE_FIXED); > >// HERE > There are a three options 1) Glob operator print while (<*>); This will print all files in the current directory. This can be modified to list files inside any directory with a while (<$dir/*>) # $dir contains the target directory path Relevant docs : perldoc -f glob perldoc File::Glob 2) opendir, readdir and closedir opendir DIRHANDLE, $dir # Open the directory $dir for reading through the handle DIRHANDLE print for (readdir (DIRHANDLE)); closedir (DIRHANDLE); # Close the handle Difference this method and the glob method is pathname returned. Using glob the output will be $dir/file.txt $dir/subdir1 (Assuming file.txt is a file subdir1 is a directory inside $dir) Using readdir the output will be file.txt subdir1 (Note that $dir/ is not prefixed) Docs : perldoc -f opendir perldoc -f readdir perldoc -f closedir 3) Using File::Find use File::Find; find (sub { print $File::Find::name }, $dir); This will recursively print all files and sub-directories within $dir Docs : perldoc File::Find HTH, Sudarsan > > > } > >What would you put where the //HERE line is in order to get a directory >listing of the $dir ? >Is there anyway I can have this directory listing to immediatly expand >subdirectories, or should I make it a recursive sub ? > >Thank you in advance, > >Frank 'Olorin' Rizzi >e-mail: [EMAIL PROTECTED] >or [EMAIL PROTECTED] > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sockets
There two via: 1) C language style, 2)using a module. 1) ##example client use Socket; ##export costants socket(SK,PF_INET,SOCK_STREAM,getprotobyname('tcp')) || die"$!\n"; ###declaration: SK is a name gived at the socket; PF_INET is a costant: socket internet; SOCK_STREAM is a costant: ## type of "flux" data(stream,for examople for tcp; datagram for example for udp). $dest=sockaddr_in($port,inet_aton($host)); ##where $host is in dot or symbolic notation connect(SK,$dest) || die"$!\n"; ##now you can print or read on the socket like a file. ##print select SK; $|=1; print "HELLO\n"; select STDOUT; ##read while(){ print"$_\n"; ###read from socket and print on STDOUT } close(SK); ### ##example 1b) server use Socket; ##export costants socket(SK,PF_INET,SOCK_STREAM,getprotobyname('tcp')) || die"$!\n"; $serv=sockaddr_in($port,INADDR_ANY)); ### INADDR_ANY is a costant: call the local IP. ### there are others costants: INADDR_BROADCAST, INADDR_LOOPBACK,INADDR_NONE. bind(NEW,$serv) || die"$!\n"; ## open a new socket descriptor listen(NEW,$num); ## $num is num of connection max in wait state. for(;;){ accept(NEW,SK); ### accept the connecton. The function wait the connection request from a client. ## ## now you can write and read like a file on NEW descriptor socket- close(NEW); ##end of connection from the client } close (SK); ## if you want you can use the fork for have a concorrent server(another mail ). 2) exaple client with the module. use IO::Socket; $socket=IO::Socket::INET->new(PeerAddr =>$host, PeerPort=>80, Proto=>"TCP") || die"$!\n"; print $socket "GET / HTTP/1.0\r\n\r\n"; while(<$socket>){ print"$_\n"; } close($socket); 2b) server with module use IO::Socket; $socket=IO::Socket::INET->new(LocalAddr =>$your_ip, LocalPort=>80, Proto=>"TCP",Listen=>5) || die"$!\n"; ##Do the socket,bind and liste function !!! ##Listen is like the $num above. for(;;){ $new=$socket->accept(); ## ## you can read and write on the $new descriptor like a file. close($new); ##and } close($socket); Walter >How can I use sockets in Perl? > > > > > > > > > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]