Re:How to delete a symlink

2002-02-06 Thread Jorge Goncalvez
Hi, I wanted to verify if a symlink exists and delete it if it exists My code is: my $program_path = "c:\\cygwin\\bootp\\linux"; my @program = ( "$program_path\\$_Globals{LX_VERSION}", "$program_path\\install", "$program_path\\linux.ram", "$program_path\\alize\\ins

flock with nfs

2002-02-06 Thread Alain
Hi, I need to use flock function with files on nfs partitions. I've read that flock only works with local files, and that perl needs to be configured to use fcntl by default, instead of flock. The only information I found is to use "-Ud_flock" with the Configure script. Does anyone know if that

RE: Study group for motivated people wanting to learn Perl.

2002-02-06 Thread Mok T.Y.-r15382
Please count me in Regards, TY Mok -Original Message- From: Kevin Werckman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 05, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Study group for motivated people wanting to learn Perl. I'm hoping to get a small study group together that

sockets help??

2002-02-06 Thread Hotmail - mrengc
Hello, Just wondering if you could give me a hand with sockets? If not I understand. I am trying to write winsock software to have one client connect to three different server computers (not simultaneously) by simple sock stream. I tried to create one socket and connect to each computer. O

Illegal character error for blank line.

2002-02-06 Thread Student of Perl
Hi there, i have very strange problem. I have a simple script which I run on Windows98 (PC) and it executed properly. But when I sent it to someboday by email who uses Unix ; it give error. The first 3 lines of the script are comments in following format. # comment1 # comment2 # comment3 ..

Re: Illegal character error for blank line.

2002-02-06 Thread Tanton Gibbs
You've run across the typical cross-platform issues that arise between Unix and Windows. The problem is that Windows uses \r\n to terminate a line while Unix just uses \n. When perl on unix sees \r it doesn't know what to do because it only expects \n. Therefore, to correct the problem, you nee

Re: sockets help??

2002-02-06 Thread walter valenti
> > >I am trying to write winsock software to have one client connect to three different >server computers (not simultaneously) by simple sock stream. I tried to create one >socket and connect to each computer. Once the previous connection is completed with >one of the computers, I would chan

Re: Illegal character error for blank line.

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, Tanton Gibbs wrote: > You've run across the typical cross-platform issues that arise between Unix > and Windows. The problem is that Windows uses \r\n to terminate a line > while Unix just uses \n. When perl on unix sees \r it doesn't know what to > do because it only expect

nonzero $! value after closing a pipe normally

2002-02-06 Thread gungor_o
Hi all, I have a code part like the following. >>> open MYPROFILE, "cat mytxtfile |"; if ( $! != 0 ) { print "h1 -> $!\n"; } while () { next if /^(tcp|udp)/; print; } close MYPROFILE or die "bad: $! $?"; if ( $! != 0 ) { pr_my_error_routine “close error i

Re: nonzero $! value after closing a pipe normally

2002-02-06 Thread Shawn
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 06, 2002 6:07 AM Subject: nonzero $! value after closing a pipe normally >Hi all, > >I have a code part like the following. > >open MYPROFILE, "cat my

socket help, last time i promise ;)

2002-02-06 Thread Scott L Ryan
I want to display a message when a client connects to the server. msg> right now, I cannot seem to display that message until I have received something from the client and I want to display it before the client sends anything. puzzling.. #!/usr/local/bin/perl use Socket; if (!@ARGV) { pr

RE: nonzero $! value after closing a pipe normally

2002-02-06 Thread gungor_o
Thank you Shawn. I will use other alternatives for error checking. OKI -Original Message- From: Shawn [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 06, 2002 2:22 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]

Re: Illegal character error for blank line.

2002-02-06 Thread William.Ampeh
In Unix, the person has to do two things 1./ On the very first line of the file, he/she has to insert the location of his/her PERL interpreter (the location of the PERL interpreter can be found with "which PERL"). For example; redhat1:/home/(38)% which perl /opt/local/bin/perl

Re:A more perlish way

2002-02-06 Thread Jorge Goncalvez
Hi, I have this : my $program_path = "c:\\cygwin\\bootp\\linux"; my $Symlink="$program_path\\install.lnk"; my $Symlink2="$program_path\\linux.ram.lnk"; my $Symlink3="$program_path\\alize\\install.lnk"; my $Symlink4="$program_path\\alize\\startup.txt.lnk"; i

Re: socket help, last time i promise ;)

2002-02-06 Thread walter valenti
Scott L Ryan wrote: >I want to display a message when a client connects to the server. > >msg> > >right now, I cannot seem to display that message until I have received >something from the client and I want to display it before the client >sends anything. puzzling.. > >#!/usr/local/bin/perl >

Re: A more perlish way

2002-02-06 Thread Frank
On Wed, Feb 06, 2002 at 03:05:29PM +0100, Jorge wrote: > I tried this: > @Symlink=("$program_path\\install.lnk", >"$program_path\\linux.ram.lnk", >"$program_path\\alize\\install.lnk", >"$program_path\\alize\\startup.txt.lnk

RE: Perl and CGI

2002-02-06 Thread William.Ampeh
A CGI script could be a shell script, a compiled program written in C/C++/PASCAL (I even have a client whose CGI programs were developed in FORTRAN), PERL, PHP, EXPECT, TCL. Basically any program that can run on your WEB server (without going in details). CGI scripts,need not contain: Content-

Re: A more perlish way

2002-02-06 Thread Matt C.
Also I think you need to put the call to phrase the system command like this: system("rm $_"); But perl has unlink, which is cleaner and could give you style points (this coming from someone who has little perl style, of course!). So you could (should?) just say: foreach (@Symlink) { unlink if

Difference between == and eq

2002-02-06 Thread wim
Hello, I have a small question: what's the difference between == and eq? When I do: if ( $menuitem == "modify_router") { print "Modify router"; } else { print "Add router"; } it doesn't work. But when I change it to: if ( $menuitem eq "modify_router") { It works! How c

Re: files

2002-02-06 Thread P0R0NG
hi andrea! thank you for your help - it did work. i have some extra problems though. in the code, i replaced nat with a variable (let's call it $section), here's my code snippet: ### start of snippet ### #this is the xml repository where all xml files where residing chdir $repository; # sec

Re: Difference between == and eq

2002-02-06 Thread walter valenti
eq: to use for the strings = : to use in numeric contest.(if you = in string contest in every true). If you don't know if are string or numerical use eq Walter > Hello, > > I have a small question: what's the difference between == and eq? > > When I do: > > if ( $menuitem == "modify_r

Re: Difference between == and eq

2002-02-06 Thread Shawn
- Original Message - From: "wim" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 06, 2002 8:39 AM Subject: Difference between == and eq > Hello, > > I have a small question: what's the difference between == and eq? == is a numeric compare 1 == 1 eq is a string

RE: Difference between == and eq

2002-02-06 Thread Murphy, Land
eq is used for comparing strings while == is used for numeric comparisons. HTH -Original Message- From: wim To: [EMAIL PROTECTED] Sent: 2/6/2002 8:39 AM Subject: Difference between == and eq Hello, I have a small question: what's the difference between == and eq? When I do: if ( $me

LISTBOX Problem

2002-02-06 Thread Mike
I am trying to populate a list box in a form with using the following script and it works fine doing it this way: #!/usr/bin/perl print "Content-type: text/html\n\n"; print "\n"; print " Current Weather Products\n"; print "\n"; print "\n"; #print "\n"; print "\n"; print "\n"; print "Zone Foreca

Not your average system() question...

2002-02-06 Thread kevin . schmidt
I understand how the system command works. I understand the difference between system() and backticks. My question is this: I want to make a call to an external program and I want the output printed to the command line as it is processing, BUT, I also want the output returned to me so that I can

RE: Not your average system() question...

2002-02-06 Thread Nikola Janceski
use : $| =1; open(COMMAND, " command | "); while(){ print STDOUT; ## do whatever you want with $_ } close COMMAND; __END__ you can then read the output and print it and whatever. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesda

help for sed

2002-02-06 Thread r p
hi everyone. i am trying to use sed in order to change all my batch script. the pb is: i have the following batch: @echo on TIMETHIS.exe k:\Validation\Soft\abc.exe k:\test_1.sct k:\Validation\PlugIn\abc.link >> k:\test_1.log @echo off exit i want to delet

RE: LISTBOX Problem

2002-02-06 Thread Troy May
The first line of here-docs should end with a semi-colon: print

Re: Illegal character error for blank line.

2002-02-06 Thread Dave Benware
Student of Perl wrote: > > Hi there, > > i have very strange problem. > I have a simple script which I run > on Windows98 (PC) and it > executed properly. But when I > sent it to someboday by email > who uses Unix ; it give error. > > The first 3 lines of the script are > comments in following

Re: flock with nfs

2002-02-06 Thread Alain
Hi, I posted this message this morning. Is there anybody who can help? Thank you On Wednesday 06 February 2002 10:33, Alain wrote: > Hi, > > I need to use flock function with files on nfs partitions. > I've read that flock only works with local files, and that perl needs to be > configured to us

Re: Difference between == and eq

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, wim wrote: > I have a small question: what's the difference between == and eq? == is for numeric comparisons, eq is for textual comparisons. See perldoc perlop -- Brett http://www.chapelperilous.net/

Re: Not your average system() question...

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002 [EMAIL PROTECTED] wrote: > I understand how the system command works. I understand the > difference between system() and backticks. My question is this: > I want to make a call to an external program and I want the output > printed to the command line as it is processing, BUT

Re: A more perlish way

2002-02-06 Thread Michael Lamertz
On Wed, Feb 06, 2002 at 03:05:29PM +0100, Jorge Goncalvez wrote: > I tried this: > @Symlink=("$program_path\\install.lnk", >"$program_path\\linux.ram.lnk", >"$program_path\\alize\\install.lnk", >"$program_path\\alize\\start

OO perl problem

2002-02-06 Thread Fitzpatrick, Matthew
Hello, my name is matthew fitzpatrick, and i am having some small difficulty in my implimentation of Mail::Sender. The problem is that when there are multiple calls to $sender->MailFile or $sender->MailMsg in my loop, only the first match for each MailFile or MailMsg actually gets sent with t

Re: regex and pattern matching

2002-02-06 Thread Dave Benware
Jeff 'japhy' Pinyan wrote: > > On Feb 5, [EMAIL PROTECTED] said: > > >Problem is I don't know how to escape the entire variable $value_a so that > >the . is not considered a quantifier. > > You have $value_a and $value_b in the wrong place in your example. Speaking of $a and $b, I seem to rec

Text block switching or HTML Templating

2002-02-06 Thread Rashid Faraby
Dear Friends, I am faced with a dilemma related to a website I am in the process of redesigning. I have a number of pages which have extensive javascript to control my drop-down menues. The thing is I have modified this section after creating all the pages for the site because I added more p

Re: regex and pattern matching

2002-02-06 Thread Brett W. McCoy
> > >Problem is I don't know how to escape the entire variable $value_a so that > > >the . is not considered a quantifier. > > > > You have $value_a and $value_b in the wrong place in your example. > > > Speaking of $a and $b, I seem to recall that both of those are special > variables in that the

RE: socket help, last time i promise ;)

2002-02-06 Thread Bob Showalter
> -Original Message- > From: Scott L Ryan [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 06, 2002 7:29 AM > To: [EMAIL PROTECTED] > Subject: socket help, last time i promise ;) > > > I want to display a message when a client connects to the server. > > msg> > > right now, I c

Re: Study group for motivated people wanting to learn Perl.

2002-02-06 Thread Kevin Werckman
"Mok T.Y.-r15382" wrote: > > Please count me in > > Regards, > TY Mok We have about 11 people so far which is great. We could use more since we are going to limit scope and topic for the study group. Although to be honest, I'd be happy using this list if there was a a way identify scope an

RE: socket help, last time i promise ;)

2002-02-06 Thread Scott L Ryan
Thanks for the response... but It is now fixed ;) I have highlighted what was the issue - walter you are the don! #!/usr/local/bin/perl use Socket; if (!@ARGV) { print "Script cannot be called with no Port Number doh!\n"; } else { $server_port = $ARGV[0]; socket(SERVER, PF_INET, SOCK_S

RE: Text block switching or HTML Templating

2002-02-06 Thread Scot Robnett
I'd say an HTML template would be the way to go. You don't need mod_perl to do HTML templating. You can install HTML::Template, which is a module of the pure perly sort. Try http://sourceforge.net/cvs/?group_id=1075 or downloadable through PPM if you are using ActiveState Perl. Scot Robnett

sort on anonymous array elements as hash values

2002-02-06 Thread birgit kellner
my %hash = ( 'keyone' => ['firstvalueone', 'firstvaluetwo], 'secondkey' => ['anothervalueone', 'valuetwoforsecondkey'], 'keythree' => ['thirdvalueone', 'thirdvaluetwo'] ); Can I sort the hash on the second element of the anonymous array? Output should be: firstv

RE: Text block switching or HTML Templating

2002-02-06 Thread Hanson, Robert
I always prefer using templates (actually HTML::Template like Scot mentioned), but it won't make you pages dynamic, each page would need to be accessed through a script. You could though use HTML::Template to create templates on your "dev" server (which would be your own PC, and then write a scri

RE: sort on anonymous array elements as hash values

2002-02-06 Thread Nikola Janceski
yes: @sorted_keys = sort { $hash{$a}[2] cmp $hash{$b}[2] } keys %hash; -Original Message- From: birgit kellner [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 06, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: sort on anonymous array elements as hash values my %hash = ( 'key

Re: Not your average system() question...

2002-02-06 Thread William.Ampeh
I usually do not use system or command ticks. I always pipe the output to STDOUT if I wish to manipulate the output of any system command. Alternatively, you could redirect output to a TEMP file, then read from that file, but "piping" is more efficient. open MY_STDOUT, "{system command} | "

RE: sort on anonymous array elements as hash values

2002-02-06 Thread Nikola Janceski
oops that should have been @sorted_keys = sort { $hash{$a}[1] cmp $hash{$b}[1] } keys %hash; -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 06, 2002 11:48 AM To: 'birgit kellner'; [EMAIL PROTECTED] Subject: RE: sort on anonymous array elemen

Kinda OT.. Updating Perl/Installing modules on a large network

2002-02-06 Thread Carl Rogers
Good day; I work in an environment where the stuff that goes onto our network is tightly regulated. In my time of subscribing to this list, I have found there to be a bunch of modules available on CPAN that we don't have access to. (Our current baseline is v5.005_03 !!!). I would like to updat

Execute perl Script

2002-02-06 Thread Mike
How do you execute a perlscript within a perl script via the web? Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: sort on anonymous array elements as hash values

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, birgit kellner wrote: > my %hash = ( > 'keyone' => ['firstvalueone', 'firstvaluetwo], > 'secondkey' => ['anothervalueone', 'valuetwoforsecondkey'], > 'keythree' => ['thirdvalueone', 'thirdvaluetwo'] > > ); > > Can I sort the hash on the second element of the

Re: sort on anonymous array elements as hash values

2002-02-06 Thread Michael Lamertz
On Wed, Feb 06, 2002 at 05:35:44PM +0100, birgit kellner wrote: > my %hash = ( > 'keyone' => ['firstvalueone', 'firstvaluetwo], > 'secondkey' => ['anothervalueone', 'valuetwoforsecondkey'], > 'keythree' => ['thirdvalueone', 'thirdvaluetwo'] > > ); > > Can I sort the hash

RE: Execute perl Script

2002-02-06 Thread Hanson, Robert
It depends on exacly what you are trying to do. "do" executes a script. `perl foo.pl` runs the script and returns the output. "system" runs the script, no output returned. "eval" runs a piece of code (usually for dynamic code). Rob -Original Message- From: Mike [mailto:[EMAIL PROTECTED

Re: Kinda OT.. Updating Perl/Installing modules on a large network

2002-02-06 Thread Gary
Carl: This is an issue that I have been dealing with in one form or another for about 5 years. In my opinion the real issue here is one of configuration management. In my case we have about 10 FreeBSD boxes all with various perl scripts running on them. We also have 3 developmental (or test

Re: Not your average system() question...

2002-02-06 Thread Christopher Solomon
On Wed, 6 Feb 2002 [EMAIL PROTECTED] wrote: > I understand how the system command works. I understand the > difference between system() and backticks. My question is this: > I want to make a call to an external program and I want the output > printed to the command line as it is processing, BUT

Re: help for sed

2002-02-06 Thread Michael Kelly
On 2/6/02 6:58 AM, r p <[EMAIL PROTECTED]> wrote: > hi everyone. > > i am trying to use sed in order to change all my batch > script. Is it just me, or is this a Perl list, not a sed list? -- Michael Kelly [EMAIL PROTECTED] http://www.jedimike.net -- To unsubscribe, e-mail: [EMAIL PROTECT

Sorting an array of hashes

2002-02-06 Thread Tomasi, Chuck
Does anyone have any clever ideas for sorting an array of hashes based on a key such as an ID number? Example: @AoH = ( { ID => 10101, UserID => 1041, Status => 2 }, { ID => 10541, UserID => 1211, Status => 1 }, { ID => 10111, UserID => 1211, Status => 2 }, { ID =

RE: Sorting an array of hashes

2002-02-06 Thread Nikola Janceski
@sorted = sort { $a->{ID} <=> $b->{ID} ## remember that $a and $b become the element of the array ## so if it's a reference to a hash use a dereferencer '->' or # $$a{ID} <=> $$b{ID} # will work too! } @AoH; foreach $item (@sorted){ print $item->{

command line arguments

2002-02-06 Thread ABhagwandin
This script gives me nothing: #!/usr/bin/perl -F/\t/ -ap print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 1816; print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 5380; print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 5370; The file is indeed tab delimited, and the sixth field should have a number in

Re: Sorting an array of hashes

2002-02-06 Thread Chas Owens
On Wed, 2002-02-06 at 14:17, Tomasi, Chuck wrote: > Does anyone have any clever ideas for sorting an array of hashes based on > a key such as an ID number? > > Example: > > @AoH = ( > { ID => 10101, UserID => 1041, Status => 2 }, > { ID => 10541, UserID => 1211, Status => 1 }, >

Re: Sorting an array of hashes

2002-02-06 Thread Shawn
- Original Message - From: "Tomasi, Chuck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 06, 2002 1:17 PM Subject: Sorting an array of hashes > Does anyone have any clever ideas for sorting an array of hashes based on > a key such as an ID number? > > Example:

Re: Sorting an array of hashes

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, Tomasi, Chuck wrote: > Does anyone have any clever ideas for sorting an array of hashes based on > a key such as an ID number? > > Example: > > @AoH = ( > { ID => 10101, UserID => 1041, Status => 2 }, > { ID => 10541, UserID => 1211, Status => 1 }, > { ID

perl/tk: checkbutton value in array?

2002-02-06 Thread Kurt Werth
I've gotta be missing something simple here. How is it possible to store the values of multiple checkbuttons in an array? The code below acts like I've created a single checkbutton: for example, selecting one of ten selects all ten. for ($x = 0; $x <= $file_counter-1; $x++) { $win_ckbox_arr

Construct Question

2002-02-06 Thread mike . silver
Hello, Can anyone stand me up on this I keep getting a warning message: "Value of construct can be "0"; test with defined() at mk_LNPTYPE_counts line 65535" What does this mean? What does line 65535 refer to? I only have about 20 lines of code.

RE: perl/tk: checkbutton value in array?

2002-02-06 Thread Nikola Janceski
for ($x = 0; $x <= $file_counter-1; $x++) { $win_ckbox_array[$x] = $right2->Checkbutton(-background=>'blue',-variable=>\$ckbox_stat[\$x])->pack (pady=>2); } ## you got backslash happy I think shouldn't it be: $right2->Checkbutton(-background=>'blue',-variable=>\$ckbox_stat[$x])->pack( pady=

Re: Construct Question

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002 [EMAIL PROTECTED] wrote: > Can anyone stand me up on this > > I keep getting a warning message: > > "Value of construct can be "0"; test with defined() at > mk_LNPTYPE_counts line 65535" > > What does this mean? > > What does line 65535 refer

RE: perl2exe

2002-02-06 Thread Jenda Krynicky
From: "Timothy Johnson" <[EMAIL PROTECTED]> > I think you are only supposed to get the nag message until you > register, but yeah, it's still there. I have not tried lately, but last time I did you could get rid of the message very easily (it was about 3 years ago). You were on

RE: Construct Question

2002-02-06 Thread mike . silver
Sorry about not including code. Basically, it is: open(REGION_NAME, ") { print "$region"; } close(REGION_NAME); Michael G. Silver Spec.- Internal Network Fort Wayne NSSC (219)-480-2751 -Original Message- From: Brett W. McCoy [mailto:[EMAIL

Re: Construct Question

2002-02-06 Thread Shawn
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, February 06, 2002 2:12 PM Subject: RE: Construct Question > > Sorry about not including code. Basically, it is: > > > > open(REGION_NAME, " > while

RE: Construct Question

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002 [EMAIL PROTECTED] wrote: > Sorry about not including code. Basically, it is: > > > > open(REGION_NAME, " while($region = ) { > print "$region"; > } You can use the default variable here ($_): while() { print; }

Re: Construct Question

2002-02-06 Thread Shawn
[snip] > > > > close(REGION_NAME); > > You should also test to make sure the close worked, like you do for the > opening. I have never heard of such a thing? Is it a common problem to have files not close? And if it does not close, what problems would you have (assuming that the file would clo

system info

2002-02-06 Thread Jesse Ahrens
Is there a perl function that'll return system info such as total RAM or other dmesg info aside from regexing dmesg itself? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Construct Question

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, Shawn wrote: > > You should also test to make sure the close worked, like you do for the > > opening. > > I have never heard of such a thing? Is it a common problem to have > files not close? And if it does not close, what problems would you have > (assuming that the file wo

RE: Sorting an array of hashes

2002-02-06 Thread Tomasi, Chuck
Thanks all for the reply! This worked wonderfully. I also tried reverse() and switching the a/b around to get a reverse sorted order with equal success. Thanks again! --Chuck > -Original Message- > From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 06, 2002 1

Re: Construct Question

2002-02-06 Thread Randal L. Schwartz
> "Shawn" == Shawn <[EMAIL PROTECTED]> writes: >> > close(REGION_NAME); >> >> You should also test to make sure the close worked, like you do for the >> opening. Shawn> I have never heard of such a thing? Is it a common problem to Shawn> have files not close? And if it does not close, wh

RE: Construct Question

2002-02-06 Thread mike . silver
I am using the -w option and yes, I do make checks for open and close. The input file is only 6 lines long. The only thing not included in the code I gave was the open/close file checks. Is this Solaris specific problem? Thanks to all for the

RE: Construct Question

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002 [EMAIL PROTECTED] wrote: > > I am using the -w option and yes, I do make checks for > open and close. The input file is only 6 lines long. > The only thing not included in the code I gave was the > open/close file checks. Well, I guess using die on a f

Re: help for sed

2002-02-06 Thread Bill Akins
I believe Perl has all of the funtionality of sed so why not use the substr() function? I have not tested it and I'm sure others here can do this in one line, but couldn't you do something like this? if ($string =~ / >>/i) { $ll = (length($string) - 3); $string = substr($string, 1, $ll); } Wit

what have I gotten myself into and how do I get out

2002-02-06 Thread John
I believe that what my application requires is a hash of hashes that each reference an array of hashes. What is the best way to rewrite this structure or the access to it so that I do not need one foreach within another? #!/usr/bin/perl -w use Strict; my %cfg = ( "outer_key1" =>

use Strict/use strict (was Re: what have I...)

2002-02-06 Thread Jeff 'japhy' Pinyan
On Feb 6, John said: >#!/usr/bin/perl -w > >use Strict; You are using Windows (sorry). Please change that line to use strict; Because Windows is case-INsensitive, 'use Strict' loads strict.pm, but because Perl is case-sensitive, the effects of strict.pm are never enabled. -- Jeff "japhy"

Accessing previous element of an array in a 'foreach' loop

2002-02-06 Thread Carl Rogers
Good day; I'm using foreach to do something to an array. is there a way I can reference a previously 'seen' element without having to traverse the array with a for(;;) statement? ie. I'd like this to work: foreach(@array) { if ($_ =~/somecondition/) { # I want to do something

RE: Accessing previous element of an array in a 'foreach' loop

2002-02-06 Thread Nikola Janceski
I can only think of setting a variable at the end of the foreach like foreach my $file (@files) { ## do stuff my $last = $file; } -Original Message- From: Carl Rogers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 06, 2002 4:40 PM To: [EMAIL PROTECT

Using require()

2002-02-06 Thread Naveen Parmar
Does require() work only twice? I've tried multiple loops only to get this to work a third time. After every time, however, it automatically exits. Here's an example: if (a = true) { require 'naveen.pl"; } else { print "You are not Naveen.\n"; exit; As long as a = true, it should call 'naveen.

Re: Accessing previous element of an array in a 'foreach' loop

2002-02-06 Thread Jeff 'japhy' Pinyan
On Feb 6, Carl Rogers said: >I'm using foreach to do something to an array. is there a way I can >reference a previously 'seen' element without having to traverse the array >with a for(;;) statement? > >ie. I'd like this to work: > >foreach(@array) { > > if ($_ =~/somecondition/) { >

Re: Accessing previous element of an array in a 'foreach' loop

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, Carl Rogers wrote: > Good day; > > I'm using foreach to do something to an array. is there a way I can > reference a previously 'seen' element without having to traverse the array > with a for(;;) statement? > > ie. I'd like this to work: > > foreach(@array) { > > if ($_

Re: Accessing previous element of an array in a 'foreach' loop

2002-02-06 Thread Jeff 'japhy' Pinyan
On Feb 6, Brett W. McCoy said: >On Wed, 6 Feb 2002, Carl Rogers wrote: > >> foreach(@array) { >> >> if ($_ =~/somecondition/) { >> # I want to do something to the element prior to $_ ($_ - 1) >> } >> } > >The problem here is that $_ is a *copy* of the element in the array -- >modif

Installing Perl

2002-02-06 Thread Chi Lin
Have you had any trouble installing Perl on 98 or 2000? I couldn't install Windows installer 1.1 in Win2K. When I tried to install the executable file, the following error is displayed: "Windows Installer installed completely" I tried to see the files, but there are no perl executable files on

Re: Accessing previous element of an array in a 'foreach' loop

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, Jeff 'japhy' Pinyan wrote: > Err, no. $_ is STILL an alias. > > my @words = qw( once upon a time ); > length > 1 and $_ = ucfirst($_) for @words; > print "@words"; # Once Upon a Time argh, yeah. I was thinking backwards. Thanks for pointing that out. -- Brett

RE: Construct Question

2002-02-06 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > Sorry about not including code. Basically, it is: > > > > open(REGION_NAME, " > while($region = ) { perldiag says: Value of %s can be "0"; test with defined() (W misc) In a conditional expression, you used , <*> (glob), "eac

run from command line

2002-02-06 Thread Booher Timothy B 1stLt AFRL/MNAC
Hello. I am trying to run a simple command to remove all the leading spaces from a file and it just isn't working. No errors, just no results - still a lot of leading spaces on each line. %perl -pi.bak -e 's/^\s+//' bomb1.txt any ideas? tim

Re: use Strict/use strict (was Re: what have I...)

2002-02-06 Thread Jenda Krynicky
From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> > On Feb 6, John said: > > >#!/usr/bin/perl -w > > > >use Strict; > > You are using Windows (sorry). Please change that line to > > use strict; > > Because Windows is case-INsensitive, 'use Strict' loads strict.pm, but > because Perl is case-sen

Re: Accessing previous element of an array in a 'foreach' loop

2002-02-06 Thread Jenda Krynicky
From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> > On Feb 6, Brett W. McCoy said: > > >On Wed, 6 Feb 2002, Carl Rogers wrote: > > > >> foreach(@array) { > >> > >>if ($_ =~/somecondition/) { > >># I want to do something to the element prior to $_ ($_ - 1) > >>} > >> } >

Re: run from command line

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, Booher Timothy B 1stLt AFRL/MNAC wrote: > Hello. I am trying to run a simple command to remove all the leading spaces > from a file and it just isn't working. No errors, just no results - still a > lot of leading spaces on each line. > > %perl -pi.bak -e 's/^\s+//' bomb1.txt

Re: run from command line

2002-02-06 Thread Dennis G. Wicks
Strange. Works for me! Is bomb1.txt writeable? What system are you running on? I tried it on linux/390 and cyqwin on NT4.0. >}On Feb 6, 15:58, Booher Timothy B 1stLt AFRL/MNAC wrote: >} Subject: run from command line >--_=_NextPart_001_01C1AF59.63C9E350 >Content-Type: text/plain; > cha

Re: use Strict/use strict (was Re: what have I...)

2002-02-06 Thread Jeff 'japhy' Pinyan
On Feb 6, Jenda Krynicky said: >From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> >> On Feb 6, John said: >> >> >#!/usr/bin/perl -w >> > >> >use Strict; >> >> You are using Windows (sorry). Please change that line to >> >> use strict; >> >> Because Windows is case-INsensitive, 'use Strict' loa

Re: run from command line

2002-02-06 Thread Brett W. McCoy
On Wed, 6 Feb 2002, Dennis G. Wicks wrote: > Strange. Works for me! > Is bomb1.txt writeable? > What system are you running on? > I tried it on linux/390 and cyqwin on NT4.0. And I tried it on Solaris 8 and cygwin on Win2k, with equal success. -- Brett

Re: packages, and scopes

2002-02-06 Thread Jenda Krynicky
Date sent: Mon, 04 Feb 2002 11:27:38 -0800 From: Tarak Parekh <[EMAIL PROTECTED]> > I was a little confused regarding scopes of packages. I did read > portions of > Programming Perl but am still a little unclear. > > Basically, I am trying to implement a simple for

Re: Illegal character error for blank line.

2002-02-06 Thread John W. Krahn
Student Of Perl wrote: > > Hi there, Hello, > i have very strange problem. > I have a simple script which I run > on Windows98 (PC) and it > executed properly. But when I > sent it to someboday by email > who uses Unix ; it give error. > > The first 3 lines of the script are > comments in foll

Inserting and array into an Oracle db

2002-02-06 Thread McElwee, Shane
Hi, I'm capturing data from a proprietary database to a flat file and I want to create tables and insert rows of data into those tables. From what I've read as long as the number of columns matches the number of elements in a row I should be able to do wholesale inserts into the oracle database.

snmpwalk with net::snmp

2002-02-06 Thread charles
i've gotten to be somewhat comfortable using net::snmp. at the very least i've used its get_request and set_request methods. however an oid used by cisco seems to need to be called using 'snmpwalk' rather than a get or set request. net::snmp has a get_next_request and a get_table, but i'm conf

Re: help for sed

2002-02-06 Thread John W. Krahn
R p wrote: > > hi everyone. Hello, > i am trying to use sed in order to change all my batch > script. Sorry, I'll have to show you a Perl solution. :-) > the pb is: > > i have the following batch: > @echo on > TIMETHIS.exe k:\Validation\Soft\abc.exe > k:\test_1.sct k:\Validation\PlugIn\abc.

Re: command line arguments

2002-02-06 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > This script gives me nothing: > > #!/usr/bin/perl -F/\t/ -ap > > print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 1816; ^ > print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 5380;

  1   2   >