Re: DBI hashref of a sum (maybe OT)

2001-12-23 Thread Abdulaziz Ghuloum
Hello, I can think of two ways to do what you want: 1. use fetchrow_arrayref and get the output by its index. while ( my $row = $sth->fetchrow_arrayref ) { $Msgs_In=$row->[2]; $Msgs_Out=$row->[3]; $Bytes

Re: Create an array of arrrays from a scalar

2001-08-07 Thread Abdulaziz Ghuloum
Hello, Having studied the dragon book and others more than once, took about 10 minutes to write this parser that worked to my surprise the first time. God bless LISP and LISP-like grammers. Aziz,,, ### program ##

Re: connectivity

2001-08-07 Thread Abdulaziz Ghuloum
Hello, Why are you not using CGI.pm? Why are you parsing the data yourself? Doing so is very error prone and you *will* get into trouble. Try doing the following in your script: #!/usr/bin/perl -w use strict; use CGI qw/param/; my $name = param('Name'); my $age = param('Age'); my $city = para

Re: Random Number Generation

2001-08-05 Thread Abdulaziz Ghuloum
Thanks for the info. Aziz,,, In article <[EMAIL PROTECTED]>, "smoot" <[EMAIL PROTECTED]> wrote: >> "Abdulaziz Ghuloum" <[EMAIL PROTECTED]> said: > >> Doesn't /dev/random produce pseudo-random numbers also? What makes >> reading

Re: Random Number Generation

2001-08-04 Thread Abdulaziz Ghuloum
Hello, Doesn't /dev/random produce pseudo-random numbers also? What makes reading from it better than using perl's rand or C's rand? Aziz,,, In article <[EMAIL PROTECTED]>, "smoot" <[EMAIL PROTECTED]> wrote: >> "." <[EMAIL PROTECTED]> said: > >> Another thing that I notice the llama book fa

Re: Fun With Perl list ???? where is it ? :)

2001-08-03 Thread Abdulaziz Ghuloum
Hello, I think perlmonks.com comes close to what you want but not exactly. Check it out anyways. Aziz,,, In article <[EMAIL PROTECTED]>, "Silvio Luis Leite Santana" <[EMAIL PROTECTED]> wrote: > Hi all > Is there actually a Fun With Perl list? (ok, this list is funny already, > but not officia

Re: Where is DB_File::Lock module?

2001-08-02 Thread Abdulaziz Ghuloum
Hello, It's on cpan: http://search.cpan.org/search?dist=DB_File-Lock Hope this helps,,, Aziz,,, In article <[EMAIL PROTECTED]>, "Carlos C . Gonzalez" <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I am going absolutely nuts trying to find where to get the DB_File::Lock > module. I have look

Re: simple

2001-07-30 Thread Abdulaziz Ghuloum
Hello, Did you know about the 'x' operator? print ' ' x 50; # this will print   50 times. Hope this helps,,, Aziz,,, In article <001c01c118dc$3926cb40$1900a8c0@shakti>, "Rahul Garg" <[EMAIL PROTECTED]> wrote: > Hello, > > In my perl script , i am writing HTML code..within it i am using

Re: counting files of a directory

2001-07-30 Thread Abdulaziz Ghuloum
Hello, Try the glob function, or the <*> glob: my $count = () = glob("/path/to/dir/*"); or my $count = () = ; Hope this helps,,, Aziz,,, In article <[EMAIL PROTECTED]>, "COLLINEAU" <[EMAIL PROTECTED]> wrote: > Hello! > > Is there a function which count the number of files in a directory ?

Re: (MORE INFO) loose matching with regex

2001-07-28 Thread Abdulaziz Ghuloum
Hello again, I have no background in genetic analysis but it looks like there is so much effort going on in the Bio:: modules. There is a module called Bio::SeqFeature::Similarity that might be doing just what you want. But then again, it may not :-) Hope this helps,,, Aziz,,, In article <

Re: (MORE INFO) loose matching with regex

2001-07-28 Thread Abdulaziz Ghuloum
Hello again, I would suggest you look at Algorithm::Diff module (available at CPAN). The function LCS, given 2 strings, gives you the "longest common sequence" between the 2 strings. Once you have the longest common sequence, you can probably decide whether it meets the 80% criterion you set or

Re: loose matching with regex

2001-07-28 Thread Abdulaziz Ghuloum
Hello, I don't have a direct answer for your question since your question is a little bit ambigious; let me explain: Do you want to search for a substring in a long string, or you want true regexp match? If you want a true regexp match, then the question is even more ambigious. For example, th

RE: regexp issues TR

2001-07-28 Thread Abdulaziz Ghuloum
Hello, I believe you don't need the /g modifier in that regexp since a single match to an unwanted character is enough. Aziz,,, In article <[EMAIL PROTECTED]>, "Wagner-David" <[EMAIL PROTECTED]> wrote: > Here is some code which does what you want: > > #!perl -w > # A-Za-z0-9_@.- > > while (

RE: 4 hashes into 1 hash

2001-07-27 Thread Abdulaziz Ghuloum
Hello, Did you mean: for(keys(%data)){ print "$_ = $data{$_}\n"; } or you actually meant the assignment print $_ = $data{$_}; Aziz,,, In article <1A191D5C8A79D511A7A800306E05E9FC067398@EXCHANGE_SERVER>, "Chris Rutledge" <[EMAIL PROTECTED]> wrote: > John, > > That works much better

Re: How to Insert Array Elements Sequentially

2001-07-26 Thread Abdulaziz Ghuloum
Hello, There are a few problems in the program you included. First is the use of split outside the loop which is not what you want. Second is using the /.?/ expression to test the length of the field where you should've used the "length" function. I guess what you needed was a way to add the

Re: "last until eof unless" question

2001-07-26 Thread Abdulaziz Ghuloum
Hello, What does "last until eof unless email" mean? I don't get what you're after. Can you explain what you're trying to do or include a snippet from your program. Aziz,,, In article <5.0.0.25.0.20010726113250.00a199b0@linus>, "David Freeman" <[EMAIL PROTECTED]> wrote: > in my script i have

Re: Another pattern question

2001-07-26 Thread Abdulaziz Ghuloum
Hello, I think what you want to do is first remove the newline character _then_ split the list. ie. open F, " my @list; while(){ chomp; # remove the \n push @list, split/\t+/; # add items to @list } Hope this helps,,, Aziz,,, In article <000901c115e3$31a71ec0$[EMAIL PROTECTED]>, "Dani

Re: output of a command to a file

2001-07-24 Thread Abdulaziz Ghuloum
Hello, There is nothing wrong in your perl program. The problem is that not all nic servers produce the same output. The line with "created on" exists for some names only, not all. I tried yahoo.com which had it and netscape.com which didn't have it. So, you should figure out a better way to

Re: Problem with scan fields using split

2001-07-24 Thread Abdulaziz Ghuloum
Hello, Please read the documentation that comes with perl about the use of split (perldoc -f split). Remember, split takes a regular expression as the first argument, not a substring. To learn more about regular expressions, perldoc perlre. Read about the usage of "*" and "+". Hope this helps

Re: reading a text file

2001-07-24 Thread Abdulaziz Ghuloum
Hello, This is not a flame. You provided a small program that does nothing but print the file. If you need help, you really should help yourself a little more by first thinking how the program should function. What are the logical steps that need to be performed to achieve what you want. Wh

Re: misinterpretation of File::Copy

2001-07-23 Thread Abdulaziz Ghuloum
Hello I've read the File::Copy perldoc and didn't see how you can pass something to preserve file ownership. So, I guess you're stuck with using "system". You can try setting the file attributes manually using chown after using File::Copy but that all depends on your situation. Sometimes it's wo

Re: misinterpretation of File::Copy

2001-07-23 Thread Abdulaziz Ghuloum
Hello, Under unix, a user cannot change ownership of a file to another user and cannot create a file with another user's ownership. So, whenever you create a file, you'll be the owner of that file. Root follows no rules of course. Hope this helps,,, Aziz,,, In article <[EMAIL PROTECTED]>, "c

Re: How to keep values from multiple pages of form?

2001-07-22 Thread Abdulaziz Ghuloum
Hello, After getting all variables of the first form using CGI.pm I assume, you place these values in hidden fields in the form on the second page. That way, when the second page is submitted, you have all variables. But then again, why do we have 2 pages? Hope this helps,,, Aziz,,, In arti

Re: regex substitution using $1

2001-07-20 Thread Abdulaziz Ghuloum
Hello, You have: my $rcs = '$Revision: 1.47 $'; # $version was a typo I believe $rcs =~ s/[^\d.]+//; The substitution matches the first sequence of non-digits and non-dots and replaces it with "" (nothing). So, it matches 'Revision: ' and you have $rcs = '1.47 $'. You need to use the 'g' mo

Re: autoflush on network connection

2001-07-20 Thread Abdulaziz Ghuloum
Hello, Apparently you're using an old version of IO::Socket that does not turn autoflushing on by default. To turn it on, use: $sock->autoflush(1); Here is a sample server: use IO::Socket; my $sock = new IO::Socket::INET(LocalPort => 5500, Listen => 5, Reuse => 1) or die "Cannot listen $!\

Re: install modules when user is not root

2001-07-19 Thread Abdulaziz Ghuloum
Hello, Try perldoc -q 'my own module' Hope this helps,,, Aziz,,, In article <01071918011800.00964@m12>, "Rizwan" <[EMAIL PROTECTED]> wrote: > Hi! all, > > I am trying to install some of the CPAN modules ,like the b::graph > module, but I am not able to because I dont have the root privilages

RE: Removing spaces

2001-07-19 Thread Abdulaziz Ghuloum
Hello, Of course this regex only removes the leading spaces only, or the trailing spaces if there are no leading spaces. You can use $string =~ s/^ +| +$//g; # g for global matches or do it in 2 steps: $str =~ s/^ +//; $str =~ s/ +$//; Hope this helps,,, Aziz,,, In article <00a301c1101e$ac7d4a

Re: question

2001-07-19 Thread Abdulaziz Ghuloum
Hello, You might want to try using the newsgroup instead of the mailing list. The address is nntp.perl.org. Hope this helps,,, Aziz,,, In article <009c01c11016$81b60840$0200a8c0@Apartment>, "Patrick Kelly" <[EMAIL PROTECTED]> wrote: > What is the website of this newsgroup? I can't afford to

RE: Newbie system call question

2001-07-18 Thread Abdulaziz Ghuloum
Hi again,, Seems like you're stuck again. Okay, the problem here is the ">/dev/null". Notice the ">" sign over there. It's the shell redirection metacharacter which causes "the shell" to pipe the output of one script to a file. When you use "system" in list context, like you're doing, you will

Re: Newbie system call question

2001-07-18 Thread Abdulaziz Ghuloum
Hello, # use @args = ("/dir1/dir2/prgname","arg1","arg2","arg3","-p","/dev/null"); $rc = system @args; since "-p" is an argument just as much as "/dev/null" is an argument. Hope this helps,,, Aziz,,, In article <[EMAIL PROTECTED]>, "Ken Cole" <[EMAIL PROTECTED]> wrote: > if from the com

Re: Really really new

2001-07-18 Thread Abdulaziz Ghuloum
Hello, The simplest way to do this is to first find the max length of the numbers: my @ar1 = qw/116 44 45 49 71/; my @ar2 = qw/1 1 3 5 1/; my $max = length ((sort {$b <=> $a} (@ar1,@ar2))[0]); # assuming all

Re: Think there is something DBI

2001-07-18 Thread Abdulaziz Ghuloum
Hello, How about doing this: my @cols = qw(firstname lastname title phone email age location address address2 city state zip zip2 inst school_type grades_taught subjectarea_1 subjectarea_2 subjectarea_3 subjectarea_4 subjectarea_5 subjectarea_6 how_heard Occupation); my $dbh = DBI->connect(.

Re: RE:Empty a file

2001-07-18 Thread Abdulaziz Ghuloum
Hello, open THE ">$file" or die $! $!; # to reset it close THE; #file? or just unlink $file; # to delete it Aziz,,, In article <[EMAIL PROTECTED]>, "Jorge Goncalvez" <[EMAIL PROTECTED]> wrote: > Hi , I have made a small installer program which is parsing a file and > this file is growing

Re: Script won't exec

2001-07-17 Thread Abdulaziz Ghuloum
Hello, > Syntax error near $ENV{'REQUEST_METHOD') Aborted due to compilation {} Why do you have a left brace and a right bracket? Hope this helps,,, Aziz,,, In article <[EMAIL PROTECTED]>, "Customer Service" <[EMAIL PROTECTED]> wrote: > To the Pleth

Re: META REFRESHES

2001-07-17 Thread Abdulaziz Ghuloum
Hello, Just a question, why are you using a meta if you can pass the header directly? The meta AFAIK is used so that the server adds the appropriate lines to the header before sending the document. For example, adding the previous line to your html file will cause the server to send "Content

Re: Regex giving me fits!! :-(

2001-07-17 Thread Abdulaziz Ghuloum
It's working here!! Aziz,,, #!/usr/bin/perl -w for $look(){ $look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/; print ++$i . " $1\n"; } __DATA__ DATE: 12/12/12 DATE 12/12/12 DATE : 12/12/12 DATE: 12/12/1212 In article <[EMAIL PROTECTED]>, "Gary Luther" <[EMAIL PROTECTED]> wrote: >

Re: sprintf question

2001-07-17 Thread Abdulaziz Ghuloum
Hello, You can use something like: print lj("Hello", 30, '*') . "\n"; #prints Hello* sub lj{ return $_[0] . ($_[2]||' ') x ($_[1] - length $_[0]); } Aziz,,, In article <[EMAIL PROTECTED]>, "F.H" <[EMAIL PROTECTED]> wrote: > Hi, > Anybody know the right syntax

Re: ps2pdf

2001-07-17 Thread Abdulaziz Ghuloum
Hello, ps2pdf and pdf2ps are shell scripts that fire gs to do the actual conversion. Are we talking about the same thing or two things with the same name? Aziz,,, In article <01071717292301.07584@m12>, "Rizwan" <[EMAIL PROTECTED]> wrote: > The module is perl script... I think this relevent enou

Re: ps2pdf

2001-07-17 Thread Abdulaziz Ghuloum
In article <01071714101300.07584@m12>, "Rizwan" <[EMAIL PROTECTED]> wrote: ps2pdf is part of the GhostScript suite. Does this have anything to do with perl? Aziz,,, > Hi! > I need to download ps2odf.. I have searched a lot ..but with no success. > Somebody help me! > > > Rizwan -- To unsubs

Re: getting output immediately of an application started with open-command

2001-07-16 Thread Abdulaziz Ghuloum
I believe the java application should be the one flushing its output. Since I'm not a java programmer, I wouldn't know how to do that. (output should be flushed so that the other app can read it). Hope this helps,,, Aziz,,, In article <000701c10ddb$dece5e70$77887382@jynnantonix>, "Jos I. Bouma

Re: Re:Alert Box

2001-07-16 Thread Abdulaziz Ghuloum
Hello, To check if the file exists, use the -e operator: if(-e $PROG){ system $PROG; } else { require Tk::Dialog; ... ... } Hope this helps,,, Aziz,,, In article <[EMAIL PROTECTED]>, "Jorge Goncalvez" <[EMAIL PROTECTED]> wrote: > Hi , I must implement a alert box in Perl Tk. > > A

Re: Why wont my REGEX match..

2001-07-16 Thread Abdulaziz Ghuloum
Hello, The substitution s/ //g will effectively reset the reference variables $1 $2, So, moving the line ($value = $2) up eleminates the problem. if ( $_ =~ /\{(.*)\}\s+(.*)/ ) { $dev = 1; $opt = lc($1); $value = $2; $opt =~ s/ //g; } Hope this helps,,, Aziz,,, In article <[

RE: REGEX

2001-07-09 Thread Abdulaziz Ghuloum
Hello You can use (split //) to get the characters of a string. @fields = split //, $line; printf sortcode "\n%6.6s%8.8s%27.27s%35.35s%35.35s", @fields[0..2,4..6]; # instead of $fields[0],$fields[1],$fields[2],$fields[4],$fields[5],$fields[6]; } Hope this helps Az

Re: Random field sequence tips

2001-07-09 Thread Abdulaziz Ghuloum
Hello The easiest way to do this is using hash slices. Let me explain. my %hash = (); # creates an empty hash $hash{name} = 'Aziz';# set the name $hash{id} = 512; #set the id $hash{bdate} = '12/3/1976/'; #set the bdate or, you can do this: %hash = (name => 'Aziz', id => 5

Re: RegExp

2001-06-30 Thread Abdulaziz Ghuloum
Hello, Where did you come up with $pub =~ if (//i .. /<\/pub>/i ) I guess you want to get the sting between the tags, but that's not how it's done. You can do push @pub, m#(.*?)#g; #it's better with an array but that would break if you have the and on separate lines. Basica

Re: How is this doing what I want it too?

2001-06-30 Thread Abdulaziz Ghuloum
You seem to be doing everything correctly except for the "for" loop as you've thought. You have: for($i=0; !!$b[$i]; $i++){ print STDOUT $b[$i]; } What you need instead is to say: for($i=0; $i < @b; $i++){ print $b[$i]; } Remember, @b is evaluated in scalar context (@b = number of elemen

Re: Simple Split Question

2001-06-29 Thread Abdulaziz Ghuloum
Hello, You can do it in one line like: my $str = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"'; %hash = $str =~ /DimView\s+(\d+)\s+("[^"]*")\s+/g; print "$_ $hash{$_}\n" for keys %hash; Aziz,,, On Thu, 28 Jun 2001 16:32:28 -0400, Seitz, Scott said: > I'm having

Re: Problem with hash value

2001-06-29 Thread Abdulaziz Ghuloum
> while (<>) { >chomp; >print "card of $_ is:" &card($_), "\n"; > } ^ Add a comma (,) or a string cat (.) between the quote and the function :-) Aziz,,, On Fri, 29 Jun 2001 18:04:33 -0400, Wang, Lanbo said: > Hi Members, > > It seemed that a value

Re: Paging the Data..

2001-06-26 Thread Abdulaziz Ghuloum
You can limit the number of records returned by the query by using the SQL LIMIT modifier "select * from mytable where status = 1 limit 10;" Consult *your* database engine for more information. Aziz,,, On Tue, 26 Jun 2001 19:41:45 +0800, Rajeev Rumale said: > Hi, > > I have a SQL query wh

Re: regex

2001-06-20 Thread Abdulaziz Ghuloum
Hello Say you obtained the output using the backticks: $str = `(timex ps -ef > /dev/nul) 2>&1`; then just $str =~ s/^\s+//; # remove the first line %timex = split(/\s+/, $str); print "$_: $timex{$_}\n" for keys %timex; will output: real: 0.00 user: 0.00 sys: 0.00 (order is not preserved, but

Re: fork .. regex ... etc..

2001-06-20 Thread Abdulaziz Ghuloum
Hello Ron and everybody on this list. In order to find the best way to complete the task the fastest way, you need to first analyse your system and how it's going to react to your algorithm. Basically your task can be split into 2 parts, one IO intensive part (reading the files) and one CPU inte

Re: how to parse out overlap string?

2001-06-06 Thread Abdulaziz Ghuloum
On Wed, 6 Jun 2001 09:43:09 -0700 , Xitong Li said: > > Case 1: overlap is in the beginning of a string > $string1 = > "longoverlapstringfollowedbylongrandomstringadfjakjekjtanc;zitkl;nv;ihqkktls > adfjkalfdjladfjladfl" > $string2 = > "longoverlapstringfollowedbylongrandomstringqiutrnzukt

Re: $str++ $str--

2001-06-03 Thread Abdulaziz Ghuloum
On 03 Jun 2001 11:18:57 AST, Abdulaziz Ghuloum said: oops, $str should be 'ab9' not 'ab1' in this example. > $str = 'ab1'; > $str++; > print "$str\n"; # can you take a guess? Answer: 'ac0' _

$str++ $str--

2001-06-03 Thread Abdulaziz Ghuloum
Hello everybody Incrementing and decrementing strings are quiet puzzling to me. I don't seem to figure out the rationale behind the use of the increment (++) and decrement (--) operators when it comes to strings. Let me illustrate: $str = 'hello'; $str++; print "$str\n"; # here we get "hellp".

Re: IO::Select problems

2001-06-02 Thread Abdulaziz Ghuloum
Hello, I'll try to explain what I think is happening, hoping it may be helpful. my @replies ; # here we're creating an IO::Select object, good my $sel = IO::Select->new(); # and adding the socket handle, good also $sel->add($socket); # we wait until there are available data to be read. #

Re: audible beep

2001-06-02 Thread Abdulaziz Ghuloum
On Sat, 2 Jun 2001 18:51:20 -0500, Me said: > > umm I don't know who sent me the \b for audible beep.. > > Er, I think they suggested "\a"... > It's \a for alert, \b for backspace. EOS :-) _ Do You Yahoo!? Get your free @yahoo.co

Re: Re: Licensing

2001-06-02 Thread Abdulaziz Ghuloum
On Sat, 2 Jun 2001 17:36:29 +0100, Nigel G Romeril said: > Licensing and restriction are tied together, If I write a Perl program and > license it to a client and he cannot easily copy or pass it on to a third > party then I can continue to profit from my work. If the source is available > he

Re: one last thought on printf

2001-06-02 Thread Abdulaziz Ghuloum
On Sat, 2 Jun 2001 12:26:20 -0400, David Gilden said: > Also I am creating unique files and was thinking of the following: > > $unique_file_name 'fourm'. (localtime) . '.html'; > > is there a better way of doing this, I am saving each entry froma web based guest >book as > a separate .h

Fw: Re: Licensing

2001-06-02 Thread Abdulaziz Ghuloum
Hello It seems like you got two issues mixed up slightly. One is the licensing issue and the other is the restriction issue. Let me elaborate: Licensing is an agreement between the program supplier and the user regarding the use of the program, redistribution restrictions, the freedom to modif

Re: Licensing

2001-06-02 Thread Abdulaziz Ghuloum
Hello It seems like you got two issues mixed up slightly. One is the licensing issue and the other is the restriction issue. Let me elaborate: Licensing is an agreement between the program supplier and the user regarding the use of the program, redistribution restrictions, the freedom to modif