Re: array inside an array

2003-10-13 Thread Sudarshan Raghavan
"N, Guruguhan (GEAE, Foreign National, EACOE)" wrote: > Hi All, > I have recently started using Perl for my project. I have a problem in > getting elements of the following array. > > @array1 = ( [ x1, x2, x3], > [ x4, x5, x6], > [ x7, x8, x9]); @array1 is an

Re: How do I convert strings to floating number?

2003-10-14 Thread Sudarshan Raghavan
Marcus Claesson wrote: > Hi there, > > I have a simple problem that I'm sure has been asked before (so why not > again ;)) > > I have a list like this: > > 1e-100 > 2e-100 > 1e-45 > 5e-10 > 1 > 10 > 20 > > and want to make correct assignments: > > 1e-100 SMALL > 2e-100 SMALL > 1e-45 BIGGER > 5

Re: How do I convert strings to floating number?

2003-10-14 Thread Sudarshan Raghavan
Marcus Claesson wrote: > > lt, gt etc. are used for string comparisons. Change 'lt' to < and 'gt' to > > > and your code should work. > > > > You're right, but this script was a simplification of a bigger one where > '>' didn't work (my mistake to not spot the difference...). Here is a > more 'rea

Re: Another sub clean up

2003-10-14 Thread Sudarshan Raghavan
[EMAIL PROTECTED] wrote: > Can someone hlpe me clean up this trim? > > Rule: remove all trailing blanks and newline/LF perldoc -q 'How do I strip blank space from the beginning/end of a string' > > > Do I need a chomp here somewhere? No, the \s+ will take care of that > > > sub trim > { my $

Re: Another sub clean up

2003-10-14 Thread Sudarshan Raghavan
simran wrote: > I wrote my self this subroutine... which comes in very handy :-) > > ..snip > > sub strip { > my $self = shift; > my $ref = shift; > > if (! ref($ref)) { > $ref =~ s/(^[\s\t]*)|([\s\t]*$)//g if (defined $ref); Why is it better to do this in two steps? Read through this

Re: Another sub clean up

2003-10-14 Thread Sudarshan Raghavan
Sudarshan Raghavan wrote: > simran wrote: > > > I wrote my self this subroutine... which comes in very handy :-) > > > > ..snip > > > > sub strip { > > my $self = shift; > > my $ref = shift; > > > > if (! ref($ref)) { > >

Re: finding a blank line

2003-10-15 Thread Sudarshan Raghavan
Jerry Preston wrote: > Hi! > > I know this is a no brainer, but this line of code does not always work: > > last if( /^\n/ or /^\s+\n/ ); last if (/^\s*$/); Out of curiosity, can you post the cases for which your statement did not work? Are these strings with embedded newlines? > > > What am I

Re: join question - maybe map

2003-10-16 Thread Sudarshan Raghavan
Gary Stainburn wrote: Hi folks, I've got a hash such as: %masters=('VSL01'=>{'type'=>'S','name'=>'Vehicle Ledger accounts'}, 'ALD01'=>{'type'=>'S','name'=>'ALD Automotive Ltd'}, 'ALP01'=>{'type'=>'S','name'=>'Alphabet GB Ltd'}, 'ANC01'=>{'type'=>'S','name'=>'ANC Rent

Re: Hash Issue or Understanding

2003-10-30 Thread Sudarshan Raghavan
The output works but it not in the order I expected: I expected my output to be: hostname, IP addrress, OS, Version, Release, Server Type, Model, Memory Size, Total CPU's. But what I got was: Model, Server Type, cpu, Release, hostname, OS, Memory Size, Version It seems to me the hash sta

Re: What is my name

2003-10-30 Thread Sudarshan Raghavan
[EMAIL PROTECTED] wrote: Hi, I have a little problem. I have script "test.pl" and inside this script I want to know what is "my name" (I mean this "test.pl". $0 will contain the program name perldoc perlvar -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PR

Re: Reading a directory and Renaming the file

2003-10-30 Thread Sudarshan Raghavan
James Parsons wrote: Hi all I've this Perl script to read all files in a directory and if it finds a file with a certain then rename the file to header, but is doesn't search the right directory and doesn't even look for the HPAY header. Ops forgot to include the script. #!/usr/bin/perl -w

Re: Simple CGI Question

2003-11-04 Thread Sudarshan Raghavan
Jack wrote: Hello, In my perl CGI script, I'm trying to extract the PID that corresponds to it. $$ contains the PID that corresponds to your script (perldoc perlvar) How do I do this? I'm also trying to extract the timestamp. The built-in perl function localtime will interest you perldoc -f loc

Re: Training in the Middle and Far East

2003-11-05 Thread Sudarshan Raghavan
Rob Dixon wrote: To all. I wonder if any subscriber from the middle and far eastern countries Why not just say "Asian Countries" can explain what training and IT experience people like them are likely to have had? Can't speak for the entire asian region (only India and Bangalore in particular

Re: Regex search using scalar

2003-11-06 Thread Sudarshan Raghavan
Paul Harwood wrote: The search patterns I am looking for are contained inside the list (each element of the list is going to be used to scan an entire log file). So "if ( /match/ )" needs to reference each element of the FOREACH loop which I will have nested inside a while loop. That's what's con

Re: sort two patterns, control structure help needed

2002-11-08 Thread Sudarshan Raghavan
On Fri, 8 Nov 2002, Alan C. wrote: > Hello, > > This must be easy. But I've not yet enough experience with Perl's control > structures. > > perl mysort.pl infile.txt > outfile.txt > > The stack of numbers with colons below reside within infile.txt > > 120:2 > 126:2 > 13:15 > 140:3 > 14:3 > 141

Re: flock problem

2002-11-11 Thread Sudarshan Raghavan
On Mon, 11 Nov 2002, Nisim, Amit wrote: > Hi All, > > > flock doesn't work when I am running flock to file x from different machines. > > What I mean: > I am running flock from machine XXX on file z > If I try to write to file z from machine YYY I succeed. > > > Do you know mechanism like fl

Re: While - Problem

2002-11-15 Thread Sudarshan Raghavan
On Fri, 15 Nov 2002, Sorin Marti wrote: > Hi all, > > I,ve got a problem. Following Code reads an Example-String in XML-Style, > filters out the necessary information and writes it in a HASH. Now I > want to read a file and not only one String. I thought that I can just > put a while-loop arou

Re: While - Problem

2002-11-15 Thread Sudarshan Raghavan
On Fri, 15 Nov 2002, Ramprasad A Padmanabhan wrote: > This will help you > > open (FILE, " > { > local($/)=undef; > $text = ; This will read the entire file ("text.xml") into $text >} > while($text = ) Making the while here redundant -- To unsubscribe, e-mail: [EMAIL PROT

Re: reg ex question

2002-11-15 Thread Sudarshan Raghavan
On Fri, 15 Nov 2002, Melanie Rouette wrote: > Hi, > I have something like: /usr/local/home/mel/file.txt and I'd like to > strip it so that I can put the path in a variable, the file name in > another one and the extention in a another one as well. How do I do > that, can I do it all in a same e

Re: Reading System-Variables

2002-11-16 Thread Sudarshan Raghavan
On Fri, 15 Nov 2002, Ano Nymus wrote: > Hi, > > the call > > $name = system"uname -a"; perldoc -f system system returns the exit status of the command. You need to use backticks or the qx operator $name = `uname -a`; Better still take a look at the Config module perldoc Config Avoid backticks

RE: Hi all, question about caracter detection

2002-11-18 Thread Sudarshan Raghavan
On Mon, 18 Nov 2002, Beau E. Cox wrote: > Hi - > > This will 'strip' all but a-zA-Z0-9: > > #!/usr/bin/perl > > use strict; > use warnings; > > my $STRING = "kjsh234Sd\nki"; > > $STRING =~ s/[^a-zA-Z0-9]//sg; > > print "$STRING\n"; > > the ~ makes the character class negat

Re: passing an array and a hash to a subroutine.

2002-11-21 Thread Sudarshan Raghavan
On Thu, 21 Nov 2002, David Buddrige wrote: > > Hi all, > > I am writing a subroutine which is intended to take an array of strings, > and concatenate each string in the array into a single [very long] string. > > > The subroutine is listed below. > > My problem is that for some reason when I

Re: output from an array

2002-11-21 Thread Sudarshan Raghavan
On 21 Nov 2002, Jose Malacara wrote: > Can someone please tell me what I'm doing wrong here? > > I have a data file that looks like this: > > jason,texas,austin > tim,denver,colorado > jose,oregon,portland > > > And a script to update the last field and output the results with the > new city:

Re: create a directory

2002-11-21 Thread Sudarshan Raghavan
On Thu, 21 Nov 2002, Tim Booher wrote: > I don't know why I am having such a tough time creating a directory. > > I have the following code, but for some reason I can't create a > directory: > > #!/usr/bin/perl -w > # Microsoft Windows Win32 > > use strict; > use File::Find; The find functi

Re: removing white space

2002-11-21 Thread Sudarshan Raghavan
On Fri, 22 Nov 2002, Mariusz K wrote: > Hi, > > One part of my script ads several strings into one: > $text = $part1.$part2.$part3.(...etc) > > However, if the part3 through part10 were empty I get that many white spaces > at the end of $text. I thought the best thing would be just to remove th

Re: Modulus operator, unexpected results

2002-11-22 Thread Sudarshan Raghavan
On Fri, 22 Nov 2002, Poster wrote: > Hi, I am having a little trouble with a sub that is using the modulus > operator. > > It is called here-within a while loop: > while (my $row = $sth->fetchrow_hashref()) { > count++; > color_rows( $count ) > --some other stuff > tab

Re: Hashes Question!

2002-11-27 Thread Sudarshan Raghavan
On Wed, 27 Nov 2002, Ben Crane wrote: > Hi all, > > One quick Q about hashes: > > they contain a key and data? > e.g: %stuff=(A => 'one', > B => 'two'); > > where A and B are keys to data one and two...but what > happens if you have a massive text file wher you had > one key, but 2

Re: `ls -ltr`

2002-11-27 Thread Sudarshan Raghavan
On Wed, 27 Nov 2002, Mayank Ahuja wrote: > Hi all, > > Please help me out with my beginners question: > > Is there a way I can code an equivalent of `ls -ltr | tail -5` [on UNIX] > in perl ? Yes, there is If you don't want to store the output in your script system ('ls -ltr | tail -5'); Make s

Re: Hashes Question : Thank you

2002-11-27 Thread Sudarshan Raghavan
On Wed, 27 Nov 2002, Ben Crane wrote: > Cheers, > > I was going to think about using a hash for a text > file that contains information from a > file::find...there are thousands and thousands of > files I want to x-check and update it the modified > date differs...at the moment, arrays work fine

Re: convert an array to hash

2002-11-28 Thread Sudarshan Raghavan
On Thu, 28 Nov 2002, Ramprasad A Padmanabhan wrote: > Which is the quickest way of converting an array to hash keys > > I have an array > @ARRAY = qw ( a b c d e ); > > # Convert array to hash keys , so can easily check for exists > # The values of the hash are immaterial to me > > @HASH{@ARRAY

Re: oneliner to delete last line of file

2002-11-29 Thread Sudarshan Raghavan
On Fri, 29 Nov 2002, Ramprasad A Padmanabhan wrote: > > Hello all > > I am using redhat linux 7.2 > > I am required to delete the last line of a file. Now I am doing a > cumbersome thing like this > > perl -e '@_=<>;pop @_;print @_;' $FILE > $FILE.tmp > mv $FILE.tmpl $FILE > > Cant I do it an

Re: func to see if an item exists in an array?

2002-12-08 Thread Sudarshan Raghavan
On Sun, 8 Dec 2002, christopher j bottaro wrote: > hey, > perl's got so many nifty little functions to make my life easier, i wonder if > it has anything that lets you see if an item exists in an array or if two > arrays are disjoint or the set difference of two arrays or anything like > that.

Re: How to get the biggest integers from an array?

2002-12-10 Thread Sudarshan Raghavan
On Tue, 10 Dec 2002, Mystik Gotan wrote: > Hiya, Please do not cross post. > > I'm in search for a solution. Let's say I have this array: > > @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); > > Now, how can I get the biggest integers from this array and give them a > string with their place. Le

Re: obtaining a process ID.

2002-12-12 Thread Sudarshan Raghavan
On Thu, 12 Dec 2002, Ramprasad A Padmanabhan wrote: > No Mystik he did not mean own PID he meant PID of any process > > the only way you can do it is with ps or send a mail to a unix group > for better ideas > > I always do this > > chomp($PID = `ps -ax |grep -v grep |grep $PROCESS | awk

Re: arrays and references etc....

2002-12-13 Thread Sudarshan Raghavan
Kris Gaethofs wrote: > Hi, > > I could use some help with the following problem: > > I have this input file that looks like this (after some processing): > > %1%MO%1s%.%-.0003%.%.0003%.0002%.0006%-.0005%.0020%-.0035%.0006 > %2%MO%1s%-.0001%-.0021%-.0003%.0018%.0015%.0042%-.0034%.0136%-.023

Re: Calling another perl script

2002-12-13 Thread Sudarshan Raghavan
Paul Kraus wrote: > I want the parent process to end. I am just trying to decide if I can > start a second script without having to tie them together in a batch > file. exec overlays the memory image of the calling process, i.e. the calling process is gone after the call to exec. I wouldn't exact

Re: Searching for Apache::Request or libapreq

2002-12-19 Thread Sudarshan Raghavan
Sorin Marti wrote: > Hi, > > I can't find these modules on cpan: > > Apache::Request > libapreq http://search.cpan.org/author/JIMW/libapreq-1.0/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Comparing Apples and Oranges

2003-01-09 Thread Sudarshan Raghavan
Bob Williams wrote: I have two lists. List 1 is the control list containing: Apple, Orange, Lemon, Tangerine, and Grape. List 2 contains Apple, Tangerine, Grape, and Banana. I need a script that compares the two lists and will eliminate banana from list 2 because banana is not in the control L

Re: checking if a file is empty

2003-01-10 Thread Sudarshan Raghavan
# how to check if the newly made file RF1 is empty or not ? # perldoc -f -x check the -z operator -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Copying directory structure and its content

2003-02-19 Thread Sudarshan Raghavan
Pankaj Kapare wrote: > Hi, > > I want to copy whole directory structure and its containts(may be file and folders >under source directory) to destination directory .i dont know how to do this .Can >anybody help me. > Thanks in advance ! > Pankaj Any reason for doing this in perl. To answer you

Re: dynamic arrays

2003-02-25 Thread Sudarshan Raghavan
On Tue, 25 Feb 2003, cc wrote: > Hi, > > I'm a beginner at PERL. I've used it on and off, but only > just recently got myself back into the picture. I figured > that if you forget something in PERL, it'd be easy to take > it up again. So far, I'm not too sure of the ease > of taking up PERL ag

Re: looking through directories recursively

2003-03-03 Thread Sudarshan Raghavan
On Mon, 3 Mar 2003, Kristian Rink wrote: > > Hi there, and thanks for the hint... > > > On Mon, 03 Mar 2003 12:11:51 +0100, Kristian Rink wrote: > [snip] > > The easiest way is nearly always to use the existing module > > File::Find > > for handling recursive directory/file structures. > > I'm

Re: STILL shifting through arrays of line data

2003-03-03 Thread Sudarshan Raghavan
> Okay, I'm still struggling.I just cannot seem to get my mind to > stop, look, and listen. Here's some code I'm working on: > - 8-< > use strict; You might also want to add a use warnings after use strict and check how y

Re: STILL shifting through arrays of line data

2003-03-03 Thread Sudarshan Raghavan
On Mon, 3 Mar 2003, Deb wrote: > Here's the modified script. I made some changes, as suggested, but there > was no change in the output. I've included my entire script. My head is > getting mighty flat from banging it against the wall. Oh, and I added "use > warnings;" and I haven't got a clu

Re: STILL shifting through arrays of line data

2003-03-04 Thread Sudarshan Raghavan
On Mon, 3 Mar 2003, Deb wrote: > Here's the modified script. I made some changes, as suggested, but there > was no change in the output. I've included my entire script. My head is > getting mighty flat from banging it against the wall. Oh, and I added "use > warnings;" and I haven't got a clu

Re: STILL shifting through arrays of line data

2003-03-04 Thread Sudarshan Raghavan
On Tue, 4 Mar 2003, Sudarshan Raghavan wrote: > The problem is with the last \s+, when you are parsing the final tuple > $rest contains this '-h ten-me-900'. Due to the final \s+ the above regex > will not match. This leaves $opt, $arg and $newRest as undefined. Change &g

Re: Newby first little script. (Lots of errors and wrong ways of doing things)

2003-03-04 Thread Sudarshan Raghavan
On Tue, 4 Mar 2003, Scott R. Godin wrote: > George P. wrote: > > > I noticed that you've said > > "open () or die()" > > and > > "close() or die()" > > > > If open fails, the program will kill itself, so the close function > > will never be called. > > Therefore there is no need to say "close()

Re: truth test on a hash

2003-03-06 Thread Sudarshan Raghavan
On 5 Mar 2003, jdavis wrote: > hello, > I am trying to test a key from a hash in a hash > the script gives me the desired result overall but i get > the warning ... > Use of uninitalized value in pattern match (m//) at ./passwd.pl line 26. > could someone tell me why i get this error > > here is

Re: Getting a whole directory using Net::FTP

2003-03-06 Thread Sudarshan Raghavan
On Thu, 6 Mar 2003, ruben van de vijver wrote: > Hi, > > I would like to upload and download files to a Linux server from my > Windows machine. So, I set out to write a little script that does just > that. Uploading, it turns out, is no problem. I use an "opendir" > statement to open the direc

Re: PErl subroutine

2003-03-06 Thread Sudarshan Raghavan
On Fri, 7 Mar 2003, Johnstone, Colin wrote: > Gidday All, > > please help with my subroutine > > sub cleanText{ > my $cleanedText = @_; This is the problem, assigning an array to a scalar stores the number of elements in the array (in this case the number of args to cleanText) in the scalar

Re: Query: System Errors

2003-03-11 Thread Sudarshan Raghavan
On Wed, 12 Mar 2003, Manish Uskaikar wrote: > Hi, > > Can anyone help me, regarding the trapping of system errors like segmentation fault? > I want the program to exit only after i finish completing my error_log file. 1) What kind of errors are you looking at? 2) Is this a perl question? 3) Are

Re: Query: System Errors

2003-03-12 Thread Sudarshan Raghavan
On Wed, 12 Mar 2003, Manish Uskaikar wrote: > Hi, > > Thanks for the reply. I was working with the regular expressions wanted to > know if i can have an equivalent of > > try > { > my code here > } > catch(exception e) > { > } > > Regards > Manish U > This might be of interest to you http

Re: PERL OSX --- reading a local text file

2003-03-19 Thread Sudarshan Raghavan
On Tue, 18 Mar 2003, Scott R. Godin wrote: > John W. Krahn wrote: > > > David Gilden wrote: > >> > >> OK, one problem is solved, which was the path to the data file. > >> I know there is a simple way to read in a file like the following: > >> > >> apple,2 > >> banana,4 > >> kiwi,1 > >> > >> an

Re: Unix ls -lrt | tail -1 in Perl

2003-03-20 Thread Sudarshan Raghavan
On Thu, 20 Mar 2003, NYIMI Jose (BMB) wrote: > Hello, > > How can I do this unix command in Perl ? : ls -lrt | tail -1 > Actually, i would like to get the most recent file from a given directory. my $latest = (sort {-M $b <=> -M $a} <$dir/*>)[-1]; or my $latest; while (<$dir/*>) { $lates

RE: Unix ls -lrt | tail -1 in Perl

2003-03-21 Thread Sudarshan Raghavan
gt; > $filename = `ls -ltr|tail -1 $DIRECTORY`; > > print $filename; > > Sorry, i didn't mentioned that i wanted a pure perl solution, thanks anyway. > > my $latest = (sort {-M $a <=> -M $b} <$dir/*>)[0]; > Will be my way to go, thanks Sudarshan Raghavan >

Re: Linux Environment Variable

2003-03-21 Thread Sudarshan Raghavan
On Thu, 20 Mar 2003, Ankit Gupta wrote: > Hi, > > I want to print some linux environment variables that have already been set. > Could some one let me know which command I can use to get value of > environment variables. Environment variables are available through the %ENV hash. For e.g. to get

Re: showing directories and subdirectories.

2003-03-21 Thread Sudarshan Raghavan
On Thu, 20 Mar 2003, Christopher M Burger wrote: > Hello, > > I was wondering if anyone had any ideas on how I can get a list of > directories and subdirectories. Take a look at File::Find, comes with the standard distribution perldoc File::Find > > I'm currently trying something like this: >

Re: Comparison of two log files.

2002-07-17 Thread Sudarshan Raghavan
>

Re: Mail::Mailer

2002-07-19 Thread Sudarshan Raghavan
On Fri, 19 Jul 2002 [EMAIL PROTECTED] wrote: > Hi > > I am having trouble locating the module Mail::Mailer on CPAN > > found loads of Mail modules but not the one i am looking for, am looking to > send messages by smtp. It comes as a part of MailTools http://search.cpan.org/search?dist=MailToo

Re: Pattern-Matching var - interpolation.

2002-07-19 Thread Sudarshan Raghavan
On Fri, 19 Jul 2002, Angerstein wrote: > Hello, > I have a very unfunny problem, on which i am working for hours. > > I need to find out if a string contains an other specified string. > I want to use pattern-matching. > I can´t get a match together which make this. Look at my examples, > none o

Re: Pattern-Matching var - interpolation.

2002-07-19 Thread Sudarshan Raghavan
On Fri, 19 Jul 2002, Sudarshan Raghavan wrote: > On Fri, 19 Jul 2002, Angerstein wrote: > > > Hello, > > I have a very unfunny problem, on which i am working for hours. > > > > I need to find out if a string contains an other specified string. > > I want

Re: Net::SMTP

2002-07-22 Thread Sudarshan Raghavan
On Tue, 23 Jul 2002, Manya wrote: > Hi > I am new to Perl. > My prog. goes like this > > use Net::SMTP > > > --- > it gives the message can not locate Net/SMTP.pm in Have you installed Net::SMTP, it comes as a part of libnet package. If you have installed it check that the install d

Re: sorting %hash entries

2002-07-22 Thread Sudarshan Raghavan
On Tue, 23 Jul 2002, dan wrote: > ok.. that worked, now how about if i wanted it to go the other way.. from > most to least? foreach my $MyId (sort {$usernum{$a} <=> $usernum{$b}} keys (%usernum)) { print "$MyId\n"; } This will print server.two.com server.four.com server.three.com server.one

Re: Remove 4 last letters

2002-07-23 Thread Sudarshan Raghavan
On Tue, 23 Jul 2002, David Samuelsson (PAC) wrote: > This should be really simple, just use a regexp to remove the 4 last letters from a >variable. > > $variable =~ /\S\S\S\S$/; This just checks if your patter \S... matches with the contents of $variable. This should be $variable =~ s/\S\S\S\S

Re: Net::SMTP

2002-07-23 Thread Sudarshan Raghavan
On Tue, 23 Jul 2002, Manya wrote: > > > Have you installed Net::SMTP, it comes as a part of libnet package. > > If you have installed it check that the install directory is a > > part of the @INC array. > > > > How to check if a module is installed or not ? If you are getting an error like 'Ca

Re: Using Cwd; in practice how have you used...

2002-07-24 Thread Sudarshan Raghavan
On Wed, 24 Jul 2002, McCormick, Rob E wrote: > > I read (ok, skimmed...) the results from perldoc -m cwd. I don't > understand cwd (current working directory). My questions apply to this > general scenario: > > In practice, I'd like to work with my .pl or .plx files in say, /myhome/bin/ > >

RE: del files

2002-07-25 Thread Sudarshan Raghavan
On Thu, 25 Jul 2002, Timothy Johnson wrote: > > Your script states "Attempting to delete $_", but when you actually go to > delete it, you have "unlink @private", which translates to "unlink a file > whose name is the number of elements in @private. No, unlink takes a list of files to delete a

Re: function for finding the index of an element in an array?

2002-07-25 Thread Sudarshan Raghavan
On Thu, 25 Jul 2002, Daniel David wrote: > Hi, > I couldn't seem to find a built-in function for finding the index > of an element in an array...so I wrote this one: > > > > # position_of returns the position of a string in a

Re: function for finding the index of an element in an array?

2002-07-25 Thread Sudarshan Raghavan
On Thu, 25 Jul 2002, Sudarshan Raghavan wrote: > On Thu, 25 Jul 2002, Daniel David wrote: > > > Hi, > > I couldn't seem to find a built-in function for finding the index > > of an element in a

re: directory scanning

2002-07-25 Thread Sudarshan Raghavan
On Thu, 25 Jul 2002, William Black wrote: > Hi All, > > I need an idea on how to approach a script. Say I had a directory X with 50 > files in it and I have another directory Y that is suppose to have the same > exact files in it as X. How could someone approach checking directory Y > agins

Re: seperating STDOUT from STDERR?

2002-07-29 Thread Sudarshan Raghavan
On Mon, 29 Jul 2002, David Samuelsson (PAC) wrote: > I get some output in the COMMAND filehandle, as you see i try to dont show it by >hiding it into an $output , then while the COMMAND is running i want perl to >interactivly examine the $output and seach for 10% if its there is should only pr

Re: What Modul for use with imap?

2002-07-29 Thread Sudarshan Raghavan
On Mon, 29 Jul 2002, Angerstein wrote: > > Hello, I have a short Question, > which module can I use to work with imap-email? http://search.cpan.org/search?dist=Mail-IMAPClient. For all your module needs search.cpan.org is the place to look into > > Big thanks for helping me out. > > Bastian

Re: Problem with Net::Ping

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, Angerstein wrote: > Hello, > I wrote a big skript which uses net::ping (ping.pm) (and tk). > I noticed that the resultes of Net::Ping are not identical to the system > commad ping. > Much more Items are not reachable over Net::Ping then they are over the > system command. Th

Re: Please help

2002-07-30 Thread Sudarshan Raghavan
On Mon, 29 Jul 2002, Ning luo wrote: > > Hi Sir > > I have a perl script using system function, like > system("perl goup 1>basicName.scan 2>basicName.err"); > > goup is another perl script, what I want to do is executing goup, then print > the results to the file basicName.scan, if it abo

Re: How initialize hash inside a while loop ?

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, Jean Berthold wrote: > my @array ; > my $counter = 0 ; > # how to declare the prototype for the record used below ??? > my $record = { FS, SNAP_PATH, TAPE_POS } ; # don't function ... You don't have to declare the keys of a hash beforehand. When you say my $record = {

Re: Problem with Net::Ping

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, drieux wrote: > > On Tuesday, July 30, 2002, at 01:31 , Sudarshan Raghavan wrote: > [..] > > The system ping command sends ICMP echo packets and by default Net::Ping > > sends udp packets. This will work only if the machine you are pinging > >

Re: Problem with Net::Ping

2002-07-31 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, drieux wrote: > I was somewhat surprised that the ping("tcp") method 'failed' > on an unvarnished linux box... You are right, I got confused between the stream echo server and the tcp one. The tcp echo requests do get replied to without having to start any extra service. S

Re: use of uninitialised value...

2002-08-09 Thread Sudarshan Raghavan
On Thu, 8 Aug 2002, Nandita Mullapudi wrote: > i'm trying to run a perl script written to parse a file, and it runs fine > the way it is written, however, after making little changes to accomodate > my file, i get inundated with the following message > > "Use of uninitialized value in hash eleme

Re: to terminate a perl program

2002-08-09 Thread Sudarshan Raghavan
On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote: > Dear all, > > I am running two perl programs simultaneously. I want to stop > second whenever the first one stops. How could I do this, your kind > help is highly appreciated. If you have the pid of the other process perldoc -f kill > > regards,

Re: printing to the top of a file

2002-08-09 Thread Sudarshan Raghavan
On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote: > Hi > > I have a text file that i want to insert two lines to the top of. > how do i do this? >From the command line you can do this, this will retain you original file as filename~ perl -i~ -pe 'print "line1\nline2\n" if ($. == 1)' If you want to

Re: piping to a perl script

2002-08-09 Thread Sudarshan Raghavan
On Fri, 9 Aug 2002, Mat Harrison wrote: > hi, i am trying to get an email to feed a perl script. > > I have aliased the email address to pipe to the program but nothing. What > variables should I be looking in to get the data that is piped? for example, > command line arguments are in @ARGV. I

Re: if statement

2002-08-12 Thread Sudarshan Raghavan
On Mon, 12 Aug 2002, Javeed SAR wrote: > > > I have a small doubt; > > > My script is given below: > What it is doing is once the first condition is satisfied it is dieing, that > is if (($check_out == 0) > > I want the if statement to compare this also: > (($var5 == "Soarian_Context_Sen

Re: Still got stuck in Hashes...

2002-08-12 Thread Sudarshan Raghavan
On Mon, 12 Aug 2002, Theuerkorn Johannes wrote: > Hi there, > > I still got Problems with hashes. > > I have the following code: > > Now i want to call the Sub not onla once, but I don´t want to lose the previous >Values, so I tried this in the sub: > > push @{$ergebnis{$seriennr}}, >{tst

Re: if statement

2002-08-12 Thread Sudarshan Raghavan
On 12 Aug 2002, Felix Geerinckx wrote: > If you initialize your hash-values with '1', you don't need the > 'exists', which makes the statement even more readable: > > if (!$check_out && $cannot_co{$var5}) { > die "..."; > } Right, should have noticed that. Thanks :-) -- To

Re: getppid?

2002-08-12 Thread Sudarshan Raghavan
On Mon, 12 Aug 2002, Angerstein wrote: > Hello, > can somebody tell me what value getppid has (in the child) if the parent > process has ended? > > I could not find an answer to this. > I guess its 1 or 0, but not sure. It is 1, when the parent dies before the child the child is taken over by i

Re: Quick regexp help!

2002-08-13 Thread Sudarshan Raghavan
On Tue, 13 Aug 2002, David Samuelsson (PAC) wrote: > how do i only get the first part from this? > > RTFRT_flu@23460@\GE_Machine <- replica:GE_Machine_KI@\GE_Machine > > i get this value in $_, now i want to remove anything that is after <- including the >arrow (what i want is: RTFRT_flu@23460

Re: Quick regexp help!

2002-08-13 Thread Sudarshan Raghavan
On Tue, 13 Aug 2002, Connie Chan wrote: > regex method : > $_ =~ s/^(.+)<\-(.+)$/$1/; 1) By default the regex engine tries to match the contents of $_, so your statement can be written as s/^(.+)<\-(.+)$/$1/; 2) You don't have to escape '-' in this case, it assumes a special meaning o

Re: Idea about childs...

2002-08-13 Thread Sudarshan Raghavan
On Tue, 13 Aug 2002, Angerstein wrote: > I have a child and a parent process. > Both should die if the other has ended. > perldoc perlipc Case 1) Child dies and parent still alive In this case the signal SIGCHLD is sent to the parent. You can set up a handler to SIGCHLD like this in your paren

Re: Idea about childs...

2002-08-13 Thread Sudarshan Raghavan
On Tue, 13 Aug 2002, Sudarshan Raghavan wrote: > > Case 2) Parent dies and child still alive > From the parent you can send a signal to the child > and handle it in the child. Something like > Parent process > kill ('USR1', $child_pid); > Child process > $SIG

Re: How does ZOMBIE/defunct affect the system?

2002-08-13 Thread Sudarshan Raghavan
On Tue, 13 Aug 2002, Ahmed Moustafa wrote: > Ahmed Moustafa wrote: > > Drieux wrote: > > > >> > >> > >>use POSIX ":sys_wait_h"; > >>#... > >>do { > >>$kid = waitpid(-1,&WNOHANG); > >>} until $

Re: system command to perl variable

2002-08-13 Thread Sudarshan Raghavan
On Wed, 14 Aug 2002, Jose Malacara wrote: > Hello. I was wondering if there is a way to capture a system command into a > perl variable. I know this is incorrect, but I basically want to do something > like this: > > $date = system("date"); > print "Today is $date."; You can use backticks ins

Re: open file into hash

2002-08-14 Thread Sudarshan Raghavan
On Wed, 14 Aug 2002, Jose Malacara wrote: > Hello. I was wondering if there was a way to open a file into a hash? I know > this works for arrays, but was wondering if I this could be done for a hash > also. > > I have a file called people.data, which contains two colums: > jose 2 > ka

Re: parsing tripwire logfile

2002-08-14 Thread Sudarshan Raghavan
On Sun, 11 Aug 2002, Mat Harris wrote: > Hi, I want to automate my tripwire log reporting through email but > having it send me an email every tem minutes even when it hasn't found > anything is a bit annoying. What I want ot do is parse through the > viplation statistics and of any of them are g

Re: parsing tripwire logfile

2002-08-14 Thread Sudarshan Raghavan
On Wed, 14 Aug 2002, Sudarshan Raghavan wrote: > On Sun, 11 Aug 2002, Mat Harris wrote: > > > Hi, I want to automate my tripwire log reporting through email but > > having it send me an email every tem minutes even when it hasn't found > > anything is a bit annoyin

Re: open file into hash

2002-08-14 Thread Sudarshan Raghavan
On Wed, 14 Aug 2002, Andy Anderson wrote: > Hi: > > By first changing the % sign to a $ sign and then removing {jose} in the > print line I got it to work. I tested it in both Windows and Linux > environments with the same results. The % specifies that the identifier is a hash and the $ means i

RE: How does ZOMBIE/defunct affect the system?

2002-08-19 Thread Sudarshan Raghavan
On Wed, 14 Aug 2002, Bob Showalter wrote: > > > >> > > > >>use POSIX ":sys_wait_h"; > > > >>#... > > > >>do { > > > >>$kid = waitpid(-1,&WNOHANG); > > > >>} until $kid == -1; > > > > > > > >

Re: what's wrong

2002-08-19 Thread Sudarshan Raghavan
On Thu, 15 Aug 2002, Priss wrote: > I have amended the first few lines, this works but I > wonder if this bad... > > Priss > > while (<>) > { > /(\S+)/ > and $seen_in_file1{$1} += 1; If the line that is being read is of the form word1 word2 $1 will only contain 'word1'.

Re: inserting a single word in every file (fwd)

2002-08-20 Thread Sudarshan Raghavan
Sorry! forgot to post to the list -- Forwarded message -- Date: Wed, 21 Aug 2002 00:39:30 +0530 (IST) From: Sudarshan Raghavan <[EMAIL PROTECTED]> To: Nandita <[EMAIL PROTECTED]> Subject: Re: inserting a single word in every file On Mon, 19 Aug 2002, Nandita wro

Re: regular expression (fwd)

2002-08-21 Thread Sudarshan Raghavan
Sorry!! again, failed to send to the list -- Forwarded message -- Date: Thu, 22 Aug 2002 00:29:11 +0530 (IST) From: Sudarshan Raghavan <[EMAIL PROTECTED]> To: Javeed SAR <[EMAIL PROTECTED]> Subject: Re: regular expression On Wed, 21 Aug 2002, Javeed SAR wrote: &

Re: substituting a string in a file

2002-08-21 Thread Sudarshan Raghavan
On Wed, 21 Aug 2002 [EMAIL PROTECTED] wrote: > Hi, > > I'm trying to substitute all references to a date (of the format > MMDD) in a file to the current date. I'm obviously doing something > wrong here ('cause it doesn't work!:}), as no change is made to the > config.ini file. > the $date

  1   2   3   >