Calling a subroutine - strict very strict

2005-05-06 Thread Tielman Koekemoer \(TNE\)
Hi All, I apologise for the newbie question straight off - I don't have my Camel book with me to consult. Why does the following give me an error?: -- #!/usr/bin/perl -w # # A script that gets a list of technologies that have events on Display layer. # use strict; sub q_db

RE: Calling a subroutine - strict very strict

2005-05-06 Thread Tielman Koekemoer \(TNE\)
Thanks Prasanna, that fixed it. -Original Message- From: Prasanna Kothari [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 02:26 PM To: beginners@perl.org Cc: Tielman Koekemoer (TNE) Subject: Re: Calling a subroutine - strict very strict what is "param".? If it's a variable, a

RE: Calling a subroutine - strict very strict

2005-05-06 Thread Tielman Koekemoer \(TNE\)
Maybe I should tell you what fixed it: The "param" was a string so enclosed it in single quotes. Thanks! -Original Message----- From: Tielman Koekemoer (TNE) [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 02:33 PM To: [EMAIL PROTECTED]; beginners@perl.org Subject: RE: Calling a

Where will I find perl scripts

2005-05-06 Thread Tielman Koekemoer \(TNE\)
Hi All, I think I'm like most people learn Perl easier when examining other "guru's" scripts. Where is the best place on the net to find Perl scripts that do everything, from doing pattern matching in arrays to making coffee? Right now, however, I think pattern matching in arrays is more import

RE: Where will I find perl scripts

2005-05-09 Thread Tielman Koekemoer \(TNE\)
Thanks all for your info - VERY informative. Although I now feel the need to say: Hang in there Charles. I'm sure not all Perl babes rate their partners according to their scripting prowess. All drop-dead gorgeous Perl programmers, you know who to contact... ;) Thanks again, Tielman -Origi

Pattern matching problem

2005-05-10 Thread Tielman Koekemoer \(TNE\)
Hi all, I have tried various regular expressions to remove null or empty values on array @array1 and create a new array @OPD01 with the values. This, however, does not work as I still get a number of empty values in the @OPD01 array after this processing. As you'll see I tried various things - che

RE: Pattern matching problem

2005-05-10 Thread Tielman Koekemoer \(TNE\)
>> $counter2 = 0; >What's that for? (never used) Hmm yeah sorry that was supposed to be $counter = 0; >Use push() to avoid holding the current array index. What do you mean by "holding the index"? >my @array1=(' ', 'a', '', 'b', "\0", 'c', undef, 'd', ' ', 'e'); my @new=grep {$_ and !/^\s+$/

RE: Pattern matching problem

2005-05-10 Thread Tielman Koekemoer \(TNE\)
Ah I see: use push() to add scalars/lists to arrays. Thanks everyone for the help. > Use push() to avoid holding the current array index. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Emulate "tail -f" on file

2005-05-18 Thread Tielman Koekemoer \(TNE\)
Hi All, If I wanted to monitor a file in a way that would emulate "tail -f" (in the shell), how would I open the file? open(FILE, " filename |"); (?) TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Emulate "tail -f" on file

2005-05-20 Thread Tielman Koekemoer \(TNE\)
pe [mailto:[EMAIL PROTECTED] Sent: 19 May 2005 09:48 AM To: Ramprasad A Padmanabhan Cc: beginners@perl.org Subject: Re: Emulate "tail -f" on file On Thu, May 19, 2005 at 11:54:35AM +0530, Ramprasad A Padmanabhan wrote: > use File::Tail; > > > On Thu, 2005-05-19 at 11:3

To Thread or not?

2005-05-24 Thread Tielman Koekemoer \(TNE\)
Hi all, I need to execute a shell command in a loop but the shell command takes about 1 minute to complete. I want to execute the shell command but but then continue processing. Usually I would "background" the process with & but this does not work as Perl waits for the process to exit before ret

RE: To Thread or not?

2005-05-24 Thread Tielman Koekemoer \(TNE\)
Thanks, I had a look at fork() and system(). I think system() would work better in my case. Thanks! -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: 24 May 2005 02:34 PM To: Tielman Koekemoer (TNE); Perl Beginners Subject: RE: To Thread or not? Tielman Koekemoer

Can't use subscript in angle brackets

2005-05-24 Thread Tielman Koekemoer \(TNE\)
Hi all, Why can't I use a subscript in the angle brackets? e.g. @files=`ls /app2/koekemtn/scripts/dbstats/test`; chomp $files[0]; open ( $files[0] , "<$files[0]") || die "Cannot open $files[0]\n"; while (<$files[0]>) { print "$_"; } TIA

RE: Can't use subscript in angle brackets

2005-05-25 Thread Tielman Koekemoer \(TNE\)
Thanks for the help. So I cannot use an array or hash in angle brackets as file handle. I have a variable amount of files which I'd like opened and the contents shuffled. What would be the best way to do this as my next idea also did not work? _BEGIN_ @files=`ls /app2/koekemtn/scripts/dbstats/te

RE: remove duplicate lines

2005-05-30 Thread Tielman Koekemoer \(TNE\)
> Wow, I'm really confused. I'm trying to remove duplicate > lines from a marc21 text file. I have spent countless hours > searching for scripts etc. I'm also very new to Perl and wrote a long and newbyish script that does exactly what the Unix command "sort FILENAME | uniq" does just to see

RE: background system call

2005-06-01 Thread Tielman Koekemoer \(TNE\)
> Hey, Hi > > Within a perl script of mine, I'd like to execute a shell > command but have it sleep for a few minutes prior to doing > so. There are probably better ways but I can't think/find any > at the moment to do so, what I tried so far is shown here: > > system("sleep

Read output from script line by line

2005-06-09 Thread Tielman Koekemoer \(TNE\)
Hello all, Is there a way you read input from a script line by line. I'd rather parse output line by line than do: @out = `script.sh`; which seems sloppy. Or is that the best way? TIA

RE: Read output from script line by line

2005-06-09 Thread Tielman Koekemoer \(TNE\)
Thanks Marcos. > -Original Message- > From: marcos rebelo [mailto:[EMAIL PROTECTED] > Sent: 09 June 2005 09:48 AM > To: Tielman Koekemoer (TNE) > Cc: Perl Beginners > Subject: Re: Read output from script line by line > > This way works > > open

RE: Read output from script line by line

2005-06-09 Thread Tielman Koekemoer \(TNE\)
Thanks Thomas. > -Original Message- > From: Thomas Bätzler [mailto:[EMAIL PROTECTED] > Sent: 09 June 2005 09:50 AM > To: 'Perl Beginners' > Cc: Tielman Koekemoer (TNE) > Subject: RE: Read output from script line by line > > Tielman Koekemoer (TNE)

RE: equivalent of break command?

2005-06-13 Thread Tielman Koekemoer \(TNE\)
> I'm trying to write a perl script that automates g++. > There is an if statement in the script that basically works like this: > > if there are no arguments > { >print an error message >break (end the program) > } The "last" (same as break in C/Java) and "next" (same as continue in C) f

RE: remove duplicate lines

2005-06-13 Thread Tielman Koekemoer \(TNE\)
> > I'm also very new to Perl and wrote a long and newbyish script that > > does exactly what the Unix command "sort FILENAME | uniq" > does just to > > see how it can be done. > > How long? Because you can do that on one line in perl. :-) Hi John (we're not worthy - Wayne's World) ;-) I've ju

fork() and returning hash / strings to the parent

2005-06-30 Thread Tielman Koekemoer \(TNE\)
Hi all, I have some subroutines that return information. Since the each subroutine takes a snapshot of data on networked servers that should be compared, I want the subroutines to execute in the shortest time possible - I'd like to get all the subroutines running at the same time. I thought of u

fork() and returning hash / strings to the parent - take2

2005-06-30 Thread Tielman Koekemoer \(TNE\)
// Apologies for the wonderful Oulook formatting in the last email. I'm posting again so everyone can read it. Hi all, I have some subroutines that return information. Since the each subroutine takes a snapshot of data on networked servers that should be compared, I want the subroutines to execu

How do I get a Hash name after passing the ref?

2005-07-04 Thread Tielman Koekemoer \(TNE\)
Hi all, After I passed a hash ref to a subroutine, how can I see what the hash name was? i.e.: my %hash1 = ( one => 1, two => 2 ); check_limit(\%hash1); sub check_limit { my $hname = $_[0]; my $num = 0; for (keys %{$hname}) { $num++ }; print "Hash: $hname has $num key

RE: string to array conversion

2005-07-04 Thread Tielman Koekemoer \(TNE\)
> > Hi, Hello > > I've the string > > $s="101001000"; > > I need to access each bit in this string individually(i.e.,1 and 0 > > ,etc). In other words, I need a method to convert $s to array > > like @arr, in which @arr[0]=1, @arr[1]=0 ,@arr[2]=1;... Have a look at the "split" function -

RE: How do I get a Hash name after passing the ref?

2005-07-04 Thread Tielman Koekemoer \(TNE\)
> > After I passed a hash ref to a subroutine, how can I see > what the hash > > name was? i.e.: > > I don't think that's possible. Why do you need that? Well in my case, the program builds some large hashes so I don't want to copy them from sub to sub. So I pass the ref to a sub and some repeta

RE: How do I get a Hash name after passing the ref?

2005-07-04 Thread Tielman Koekemoer \(TNE\)
> Do you know this notation? > > $hashref->{key} > Yes I know how to dereference a ref. I wanted to know if you could get the name of a hash (in my case, but this could be applied to any data type) from a ref: BEGIN %hash = ( one => 1, two => 2 ); do_sometin(\%hash); sub do_sometin {

RE: How do I get a Hash name after passing the ref?

2005-07-04 Thread Tielman Koekemoer \(TNE\)
> This is just an example of a problem I'm experiencing writing a larger program. > > my %hash1 = ( one => 1, two => 2 ); > > check_limit( '%hash1', \%hash1 ); > > sub check_limit { > my ( $hname, $href ) = @_; > > my $num = keys %$href; > print "Hash: $hname has $num k

When to use defined

2005-07-05 Thread Tielman Koekemoer \(TNE\)
Hi all, When checking if the hash key exists, should I use defined() or just: do_something if $hash{val} I have done some tests and it seems there is no difference in performance with or without defined(). When should defined() be used then if it makes no difference? TIA! ~~~

RE: reading a big file

2005-07-20 Thread Tielman Koekemoer \(TNE\)
> > > I need to create a program which reads a file from the > LAN, and that > > > file is continuously updated (kind of log). I can really suggest File::Tail - it's a BRILLIANT module. ~~ This e-mail and its contents are subject t

Alcatel CORBA 5620 OSS

2005-10-17 Thread Tielman Koekemoer \(TNE\)
Hi all, We have an Alcatel CORBA 5620 gateway from which we have extract information. Does anyone know of a module that would enable Perl to access this service? I searched the CPAN's archive but could not find anything. Apologies if this is the wrong list to ask - which would be the best list?

RE: Alcatel CORBA 5620 OSS

2005-10-18 Thread Tielman Koekemoer \(TNE\)
> > We have an Alcatel CORBA 5620 gateway from which we have extract > > information. Does anyone know of a module that would enable Perl to > > access this service? > > > > I searched the CPAN's archive but could not find anything. > Apologies > > if this is the wrong list to ask - which would be