Re: OT - Interesting Perl output; What is it?

2002-09-05 Thread Dharmendra Rai
Number is say XY then u can write it as 10X+Y. Now you are doing 10X+Y - (10Y+X) which is 9(X-Y) where X and Y lie between 0 and 9 . when X >Y you get multiples of 9 in increasing order and when X

Re: Hash of Hashes woes...

2002-09-05 Thread Dharmendra Rai
Pass the keys($dom,$eng...) by ref. All you are doing is passing the array by reference which has a copy of your keys. - Get a bigger mailbox -- choose a size that fits your needs.

Re: return, wantarray, hash goodness

2002-09-05 Thread Janek Schleicher
Wiggins D'Anconia wrote at Thu, 05 Sep 2002 02:58:45 +0200: > ... > Question 1: Is there a way to differentiate the return context between > "array context" and "hash context" from what I have seen there is just > one big "list context"?? > ... > ... You might also have a look to the CPAN mod

Re: Attributes of files on SMB shares

2002-09-05 Thread Dharmendra Rai
On Linux , open /etc/smb.conf and set the attributes there. It is basically for setting the attributes for printers etc. But every thing is file on linux so you can do it. __ Do You Yahoo!? Everything you'll ever need on one web page from News and

Re: HELP !! displaying Associate Array value pairs

2002-09-05 Thread Michael Lamertz
On Tue, Sep 04, 2001 at 07:20:27PM +0200, Quincy Ntuli wrote: > > greetings > > I am trying to return the value from an associate array; i do not understand what i >am doing wrong. > ...code that others already commented on snipped... > $theHash{'$sortedListing[1]'} =[$dbRec]; You h

Re: Perl distribution and use

2002-09-05 Thread zanardi2k2
Zanardi2k2 wrote: > Now, my question: > - if i want to run my scripts on different machines over the network > (Windows), should i install a Perl interpreter on each machine or can > i point to a network perl executable without troubles? > > TIA > An add-on: i *tried* running perl from a netw

Re: substr or anything like that

2002-09-05 Thread zanardi2k2
James Edward Gray II wrote: > If you have fixed width values, separated by spaces and with no spaces > in the values, you could use the super simple: > > @list_of_values = split ' ', $fixed_width_line; No, unfortunately i do have spaces in values. Felix suggestion seems the right way to do it

Re: inserting a single word in every file

2002-09-05 Thread Nandita Mullapudi
Hi Thanks alot for your help, i finally got my word inserted just once in every file (was re ALIGNMENTS..) yea...am kinda slooow! :) nandita -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Please~

2002-09-05 Thread Steve Maroney
Ok Thank you, Steve Maroney On Wed, 4 Sep 2002, tang karen wrote: > Dear Sir and Madam. > > Please don't send me any mail. > Thank your! > > > > > _ > Join the world’s largest e-mail service with MSN Hotmail. > http://www.hotmail.c

Reading Directory

2002-09-05 Thread Fabian Funk
Hi, I'm pretty new to perl. I want to open a Directory with mp3 files an other files. My Poblem is i need only the mp3 files. How can i get only the mp3 files and not other files ? I tried: while (defined(my $file=readdir(DIR))) { next if $file=~ /^\.\.?$/; next unless /\.[mp3]

Re: converting a list into array

2002-09-05 Thread ANIDIL RAJENDRAN
Hi, The answer is in your question. Cheers - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 04, 2002 1:49 PM Subject: Re: converting a list into array > The script gave a syntax error at > > chomp(my @data = ); > > However, when I tri

getting an intersection between two arrays....

2002-09-05 Thread Anthony E.
ie - i have two arrays (lists): @hrefs: a list of urls.. and @banned, and list of bad urls. I want to remove the @banned urls from @hrefs. How would i do this? __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com

Re: sorting of arrays

2002-09-05 Thread zanardi2k2
Felix Geerinckx wrote: > (...) > Or, by using push, you take the next available position: > > push @array, 3; > > is the same as > $array[2] = 2; > (...) Maybe a typo? push @array, 3; should be the same as $array[2] = 3; -- Zanardi2k2 -- To unsubscribe, e-m

Re: Reading Directory

2002-09-05 Thread Michael Lamertz
On Wed, Sep 04, 2002 at 09:41:54PM +0200, Fabian Funk wrote: > Hi, I'm pretty new to perl. I want to open a Directory with mp3 files an > other files. My Poblem is i need only the mp3 files. How can i get only > the mp3 files and not other files ? > > I tried: > > while (defined(my $file=readd

Re: Reading Directory

2002-09-05 Thread Janek Schleicher
Fabian Funk wrote at Wed, 04 Sep 2002 21:41:54 +0200: > Hi, I'm pretty new to perl. I want to open a Directory with mp3 files an > other files. My Poblem is i need only the mp3 files. How can i get only > the mp3 files and not other files ? > > I tried: > > while (defined(my $file=readdir(DIR

RE: Reading Directory

2002-09-05 Thread Jeff AA
Why not: my $spec = "/var/www/*.mp3"; my ( @files ) = glob $spec; print "Checked '$spec' - found ", scalar(@files), " files:\n ", join("\n ", @files ), "\n"; regards Jeff > -Original Message- > From: Fabian Funk [mailto:[EMAIL PROTECTED]] > Sent: 04 September 2002 20:4

Re: getting an intersection between two arrays....

2002-09-05 Thread Sudarshan Raghavan
On Wed, 4 Sep 2002, Anthony E. wrote: > ie - i have two arrays (lists): > > @hrefs: a list of urls.. > and @banned, and list of bad urls. I want to remove > the @banned urls from @hrefs. This is a faq, perldoc -q intersection > > How would i do this? > > > __

Re: Reading Directory

2002-09-05 Thread Omanakuttan
opendir DIR, while (defined(my $file=readdir(DIR))) { next unless $file=~/\.mp3$/i ; push(@files,$file); } works for me. Omanakuttan N, C,C++,Networking, perl, Linux Tata Elxsi Ltd, ph.8410 222 x 414. --- ' ...follow me' ,

Re: Reading Directory (fwd)

2002-09-05 Thread Sudarshan Raghavan
Forgot to forward to the list, sorry again -- Forwarded message -- Date: Fri, 6 Sep 2002 15:19:58 +0530 (IST) From: Sudarshan Raghavan <[EMAIL PROTECTED]> To: Fabian Funk <[EMAIL PROTECTED]> Subject: Re: Reading Directory On Wed, 4 Sep 2002, Fabian Funk wrote: > Hi, I'm pretty

Perl debugging: dumpvar.pl Data::Dumper Dumpvalue et al?

2002-09-05 Thread Jeff AA
I have used Perl for a while, and always used dumpvar.pl / main::dumpvalue() to dump out things (I guess that tells you how long! 8-)) I had a look at Data::Dumper - but its dumps are either too terse (i.e. all one line) or too verbose (i.e. I am dumping data structures and don't really need to w

Re: getting an intersection between two arrays....

2002-09-05 Thread Dharmendra Rai
could you please mail an example so that your query become clearer. do you have any criteria for distinguishing between the bad and good ones. if yes, then use that to get the "bad elements" from href . well your example can make the question clearer.

Weekly list FAQ posting

2002-09-05 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address)

Re: sorting of arrays

2002-09-05 Thread Felix Geerinckx
on Thu, 05 Sep 2002 08:46:08 GMT, [EMAIL PROTECTED] (Zanardi2k2) wrote: > Felix Geerinckx wrote: > >> push @array, 3; >> >> is the same as >> $array[2] = 2; >> (...) > > > Maybe a typo? > > push @array, 3; > > should be the same as > > $array[2] = 3; Indeed.

RE: Newbie question - Can smtp send attachments?

2002-09-05 Thread Yuen, Alex
Thanks to everyone for there help. I manage to get it to work for what I need it for. Now onto other stuff. :-) > -- > From: Tim Musson[SMTP:[EMAIL PROTECTED]] > Reply To: Tim Musson > Sent: Wednesday, September 04, 2002 8:46 PM > To: [EMAIL PROTECTED] > Subject:

Detecting module existence

2002-09-05 Thread Pete Emerson
How do I detect whether a module is installed or not? For example, if a script is running as root, this would be useful: if (Tk is not installed ) { # This is what I need. print "Do you want to install the Tk perl module? (y/n) [n] >> "; my $answer=; exit if ($answer!~/^[Yy]/); print "You

DB_File to read Berkeley db

2002-09-05 Thread Ramprasad A Padmanabhan
Hello All I think my question is slightly misplaced in this newsgroup I have been using DB_File.pm to read Berkely db files Is there a similar library for C ( not C++ ) I have been trying google search but could get one Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

Strange error

2002-09-05 Thread Lance Prais
All, I am experiencing the most bizarre problem with my perl script. I am running the below script on windows nt, that may be the root of the problem.. The script reads a file and checks to see it the words "Sleeping for 10 seconds" appears. If it appears four times in a row it sends a text mes

Re: Detecting module existence

2002-09-05 Thread Pete Emerson
I think I may have answered my own question. Is there a "better way" (TM) or a more efficient way? eval { require Tk }; if ($@) { # module is NOT installed # code here to make sure user is root and wants to proceed system('perl -MCPAN -e \'CPAN::Shell->install("Tk")\''); } use Tk; etc. etc.

Re: Detecting module existence

2002-09-05 Thread Pete Emerson
I think I'm going in circles. Sorry about the multiple postings. The program barfs on 'use Tk' even though by the time I get to the 'use Tk' the Tk module should be installed. I tried doing require Tk; import Tk; but then I get this message: Bareword "MainLoop" not allowed while "strict subs" in

Re: Development / Production configuration switching

2002-09-05 Thread drieux
On Wednesday, Sep 4, 2002, at 12:30 US/Pacific, Jason Frisvold wrote: [..] > > Any idea on how to do this? Thoughts? Suggestions? Code!? > > --- > Jason H. Frisvold first off, I totally agree with phi - there is no quick and easy solution... but some experience I have

Re: DB_File to read Berkeley db

2002-09-05 Thread drieux
On Thursday, Sep 5, 2002, at 07:32 US/Pacific, Ramprasad A Padmanabhan wrote: > Hello All >I think my question is slightly misplaced in this newsgroup > I have been using DB_File.pm to read Berkely db files > Is there a similar library for C ( not C++ ) > >I have been trying google sear

Re: getting an intersection between two arrays....

2002-09-05 Thread david
sounds like you want to remove all @banned from @hrefs right? if your arrays are small and you don't care using up a little memeory: my @hrefs = (1..10); my @banned = (3..6); my %hash; @hash{@a} = (); delete @hash{@b}; #-- remove 3,4,5,6 from 1 to 10 foreach my $i (keys %hash){ print "

Re: Detecting module existence

2002-09-05 Thread Jeff 'japhy' Pinyan
On Sep 5, Pete Emerson said: >I think I'm going in circles. Sorry about the multiple postings. >The program barfs on 'use Tk' even though by the time I get to the 'use >Tk' the Tk module should be installed. 'use Tk' happens at compile-time. The trick is to make the test happen at compile-time

writing stdout to disk in chunks

2002-09-05 Thread Chad Kellerman
Hello, I am having issues with writing standardout to disk. ( in chunks) I have a small backup script that runs. It uses Net::SSH::Perl to send a tar command to the hoem directory of a server. The tar command pipes eveything to STDOUT, on the backend I write that STDOUT to disk. Everything

Cant locate loadable object

2002-09-05 Thread Batchelor, Scott
Guys I am still struggling with this. If anyone can help me I would greatly appreciate it. I am trying to call the Crypt::Cracklib Module in my perl script. The error log on my server keeps giving me this: Can't locate loadable object for module Crypt::Cracklib in @INC --> Can anyone help me

Re: Detecting module existence

2002-09-05 Thread Pete Emerson
If I put a lot of subroutines in the BEGIN { } section, so that they load at compile-time, what is the disadvantage? BEGIN { eval { require Tk; }; if ($@) { # Do the NoGUI stuff here exit; } sub LotsOfSharedSubsHere { } } use Tk; print "GUI section.\n"; Lo

Re: Detecting module existence

2002-09-05 Thread david
Pete Emerson wrote: > I think I'm going in circles. Sorry about the multiple postings. > The program barfs on 'use Tk' even though by the time I get to the 'use > Tk' the Tk module should be installed. > I tried doing require Tk; import Tk; > but then I get this message: > Bareword "MainLoop" not

RE: getting an intersection between two arrays....

2002-09-05 Thread Bob Showalter
> -Original Message- > From: david [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 05, 2002 1:07 PM > To: [EMAIL PROTECTED] > Subject: Re: getting an intersection between two arrays > > > sounds like you want to remove all @banned from @hrefs right? > if your arrays are small

Re: format list

2002-09-05 Thread david
that doesn't really work. if you have a large list and don't want to spell out each individual elements, try generating the format list yourself and then just eval it in run time like: #!/usr/bin/perl -w use strict; my @a = (1..5); my $eval = <<'START'; format FM = = a

Re: Strange error

2002-09-05 Thread John W. Krahn
Lance Prais wrote: > > I am experiencing the most bizarre problem with my perl script. I am > running the below script on windows nt, that may be the root of the > problem.. The script reads a file and checks to see it the words "Sleeping > for 10 seconds" appears. If it appears four times in a

RE: Strange error

2002-09-05 Thread Lance Prais
Let me ask this then. If I wanted to work around the fluctuations, could I just search for a string in the doc rather the going to a position and only looking there? If so does anyone know of documentation on the web that would help me with this? Thanks Lance -Original Message- From: J

Re: script debug help

2002-09-05 Thread Mike Singleton
Yes, I agree that it very hard to read, and next to impossible to debug. I appreciate everyone's comments very much. I will use your troubleshooting method, but the kicker is the the damned backup program write these random log file names (thus the my @files = glob('3*.log');), so I could only thi

Re: Perl debugging: dumpvar.pl Data::Dumper Dumpvalue et al?

2002-09-05 Thread Peter Scott
In article <001501c254d3$2666a910$3864a8c0@comice>, [EMAIL PROTECTED] (Jeff Aa) writes: >I have used Perl for a while, and always used dumpvar.pl / Plze don't. AFAIK the only thing in the core that uses it is the debugger. I would so love to deprecate it. You think it's hard to use, you s

how do send keys

2002-09-05 Thread Tyler, Grayling
How do I start a program in perl and send keystrokes to it?? thanks This electronic message may contain confidential or privileged information and is intended for the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distributio

Initializing...

2002-09-05 Thread Elliot Tobin
If my constructor takes four arguments, ala: my ($instanceName, $instanceHost, $instanceUser, $instancePass) = @_; What's an eloquent way of looping through those four and setting their value to "" if there are no arguments passed? -=[ Elliot @ pixeltree.org ]=- -- To unsubscribe, e-mail:

Re: Initializing...

2002-09-05 Thread Jeff 'japhy' Pinyan
On Sep 5, Elliot Tobin said: >If my constructor takes four arguments, ala: > >my ($instanceName, $instanceHost, $instanceUser, $instancePass) = @_; > >What's an eloquent way of looping through those four and setting their >value to "" if there are no arguments passed? Well, I take it you mean yo

RE: how do send keys

2002-09-05 Thread Timothy Johnson
If you're using a Win32 platform, I'd look for Win32::SetupSup. -Original Message- From: Tyler, Grayling [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:44 AM To: [EMAIL PROTECTED] Subject: how do send keys How do I start a program in perl and send keystrokes to it??

Re: return, wantarray, hash goodness

2002-09-05 Thread Wiggins d'Anconia
John W. Krahn wrote: >>however I am unclear what the following is (or how >>Perl determines it, though this is less important for now if it will >>make my head hurt), >> >>if ( &call_sub_like_this ) { >>do something cool here >>} >> >>Is this void because I am not assigning the valu

my, hashref, and 2 arrays

2002-09-05 Thread Wiggins d'Anconia
Code sample: safe to assume @vals and @heads are predefined and contain equal # of values, use strict and use warnings are in place. if (wantarray) { return @vals; } else { # create hash where keys are from @heads and values are from @vals # then return a reference to that hash, onl

Re: Cant locate loadable object

2002-09-05 Thread Wiggins d'Anconia
Was your perl loaded from rpm? Can you tell us what paths are in @INC? Where is the "Crypt/Cracklib.pm" file? As far as loading other modules, let CPAN be your friend. For instance at the command line, invoke the CPAN shell with root> perl -MCPAN -e shell (configure CPAN, most questions are

Redirecting STDOUT

2002-09-05 Thread Troy May
I'm writing a script that is currently interactive ( once I'm done debugging it will be non-interactive) in that I have to tell it to keep processing data after the end of every pass. I'm looking for a way to display the script's output on my screen, but also to log it to a file if possible. I kno

stuck on finding variables

2002-09-05 Thread Chuck Belcher
I have just started using perl and I have been asked to write a script that will open a perl script, count all of the variables identified by $... and print to the screen the number of unique variables and display a list of variables used. Can anyone tell me where to start? -- To unsubscribe

Re: Redirecting STDOUT

2002-09-05 Thread Wiggins d'Anconia
You could open a file from within the script, then for each of your prints, print both to the open filehandle and also to standard out. This should work though I would imagine (hope) there is a better way. http://danconia.org Troy May wrote: > I'm writing a script that is currently interactive

RE: Redirecting STDOUT

2002-09-05 Thread Troy May
I think I found it! Read this: |tee - Tee allows for the stdout to be sent to both the screen and to a file "command |tee outfile" Does this make sense? -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 7:06 PM To: Troy May Cc:

Re: my, hashref, and 2 arrays

2002-09-05 Thread Jeff 'japhy' Pinyan
On Sep 5, Wiggins d'Anconia said: >my %vals; >@vals{@heads} = @vals; >return \%vals; That's about as concise as you can get it. >I was surprised that I could not avoid in the else doing the code in 3 >lines (obviously this isn't a huge deal). > >I was looking for something like: > >

Re: return, wantarray, hash goodness

2002-09-05 Thread Michael Fowler
On Thu, Sep 05, 2002 at 07:16:45PM -0400, Wiggins d'Anconia wrote: > if ( 1 > my_sub_that_returns ) { > # do something cool. > } > It seems like this case could go either way, that is, in some cases your > function could simply be returning a scalar value, say 0 for a failure > in the

Re: DB_File to read Berkeley db

2002-09-05 Thread Ramprasad A Padmanabhan
Drieux wrote: > > On Thursday, Sep 5, 2002, at 07:32 US/Pacific, Ramprasad A Padmanabhan > wrote: > >> Hello All >>I think my question is slightly misplaced in this newsgroup >> I have been using DB_File.pm to read Berkely db files >> Is there a similar library for C ( not C++ ) >> >>I

Re: script debug help

2002-09-05 Thread John W. Krahn
Mike Singleton wrote: > > Yes, I agree that it very hard to read, and next to impossible to debug. I > appreciate everyone's comments very much. I will use your troubleshooting > method, but the kicker is the the damned backup program write these random > log file names (thus the my @files = glob

Re: how do send keys

2002-09-05 Thread John W. Krahn
Grayling Tyler wrote: > > How do I start a program in perl and send keystrokes to it?? perldoc -f open perldoc perlopentut perldoc Expect perldoc IPC::Open2 perldoc IPC::Open3 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

Re: stuck on finding variables

2002-09-05 Thread Sudarshan Raghavan
On 5 Sep 2002, Chuck Belcher wrote: > I have just started using perl and I have been asked to write a script > that will open a perl script, count all of the variables identified by > $... and print to the screen the number of unique variables and display > a list of variables used. Can anyone t

RE: Strange error

2002-09-05 Thread Dharmendra Rai
Hi Read Perl regular expressions. Dharmender Rai __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

Re: A problem about Tk::Tree

2002-09-05 Thread Wang Jun
Is there anybody that can help me ? Thank you very much! > > When I use following option of the TK::Tree: > -- > Name: browseCmd > Class: BrowseCmd > Switch: -browsecmd > Specifies a callback to call whenever the user browses on an entry (usually by >si

Re: my, hashref, and 2 arrays

2002-09-05 Thread John W. Krahn
Wiggins D'Anconia wrote: > > Code sample: > > safe to assume @vals and @heads are predefined and contain equal # of > values, use strict and use warnings are in place. > > if (wantarray) { > return @vals; > } > else { > # create hash where keys are from @heads and values are from @vals

Re: Redirecting STDOUT

2002-09-05 Thread Ramprasad A Padmanabhan
Troy May wrote: > I'm writing a script that is currently interactive ( once I'm done debugging > it will be non-interactive) in that I have to tell it to keep processing > data after the end of every pass. I'm looking for a way to display the > script's output on my screen, but also to log it to a

RE: Redirecting STDOUT

2002-09-05 Thread Timothy Johnson
If you want to do the same thing without relying on an external program, you can just create a Tee function: Tee("This should print to the screen and a file.\n"); sub Tee{ open(OUTFILE,">myfile.txt"); print @_; print OUTFILE @_; close OUTFILE; } -Original Message- From: Troy Ma