Re: Free Mac Private Perl server
Shannon Murdoch wrote: Couldn't find the AFAIK version of MacPerl (CPAN was down, as usual) using the www.macperl.com link. No, no, AFAIK means as far as I know. :) Are you able to give me some direct binary links at all? Sorry, I've never used Mac. I thought the links I gave you was what you needed. Maybe using some cheap old box with Linux, Apache, perl etc., as a second machine for testing would be a good solution for you? Just an idea, I probably would do so if I couldn't have Apache and perl on my desktop machine. - RaFaL Pocztarski, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Free Mac Private Perl server
Couldn't find the AFAIK version of MacPerl (CPAN was down, as usual) using the www.macperl.com link. No, no, AFAIK means as far as I know. :) Haha sorry- never seen that abbreviated before - guess I don't belong here then... wimpers off to a corner :) Are you able to give me some direct binary links at all? Sorry, I've never used Mac. I thought the links I gave you was what you needed. Maybe using some cheap old box with Linux, Apache, perl etc., as a second machine for testing would be a good solution for you? Just an idea, I probably would do so if I couldn't have Apache and perl on my desktop machine. Hmm, I do use a WinNT box to route my ISDN connection (built underneath the staircase) throughout the house- maybe I should install Apache, Perl and an FTP server on that... Wouldn't help if I was out of my LAN however. -Shannon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XMLParser and Perl
I too (a beginner in Perl) am looking for guidance on XML and Perl. I am having to read in an XML file, parse it for specific information (MIME type, attributes and values), write the attributes/values to a hash (I am assuming) and then use win32::OLE to persist the attribute/vlaues to the custom properties of a Word or Excel document. Also it would be nice to beable to determine the number of attribute/value pairs in the XML file so as to presize the hash table. Are there any example out there or code I can use to get a good start to speed up my learning curve? There is a slight time constraint I am working with. Thanks in advance Trent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parsing HTTP links
Dave Newton wrote: RaFaL Pocztarski wrote: [EMAIL PROTECTED] wrote: I need to parse out all http links stored in a local file. You mean HTML links. Actually, while the answer doesn't change, we don't know that this is what he meant. For example, he might not want ftp:// or mailto:, both of which are HTML links but not http links! Well, in fact the answer does change. If Greg hasn't meant HTML links, then he won't have much use of HTML::LinkExtor, which I told him to use. But unfortunately we can't know that, as Greg hasn't answered yet. - RaFaL Pocztarski, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Free Mac Private Perl server
Shannon, I never did this myself but it should work for first tests to use MacPerl for the scripts (you can save scripts as cgi-scripts) and try them out with Web Sharing or, alternatively, with one of the web server applications available for download on e. g. http://www.twocows.com . This, of course, will not substitute final tests with the working system. (E. g. Unix systems discriminate between upper and lower case characters - Windows and Mac do not; Unix uses '/', Windows '\' and Mac ':' for separating path elements etc.) Cheers Stephan Tinnemeyer -- Dipl.-Chem. Stephan Tinnemeyer Lindenallee 20 24105 Kiel Germany -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html editors
are there any gui html editors out there that won't change HTML::Template tags? i am using star office for creating tables. i can do most everything else in xemacs but creating tables is so much easier with a gui editor. any ideas? matt -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parsing HTTP links
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Greg Froese) wrote: thanks for all the help with this. I actually did mean HTML Links as I am looking to parse out specific links from an HTML file. I'm not only concerned with HTTP link (a href) but also other HTML flags. Right now I'm using HTML::SimpleLinkExtor but I'm not sure that gives me exactly what I want. please let me know if HTML::SimpleLinkExtor could be improved ;) Essentially what I'm trying to do is parse out all info from a web page that is in bold (btext/b). I'm going to revisit LinkExtor but if there is a better solution, I'm all ears. HTML::SimpleLinkExtor and HTML::LinkExtor only extract information for link-like tags (a, base, img, and so on). if you want to extract stuff in other tags, you'll need to subclass HTML::Parser directly. -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XMLParser and Perl
Dear Evangelical Staff, We here at Loyola are trying to develop a uPortal Site(test-mode), which requires IBM XML Parser for IBM Java2-SDK 1.3-9.0 under Linux RedHat 7.1. - There is documentation from O'REILLY called Java and XML Tips and Tricks, but, I don't think this is going to help us much, it seems that it is difficult to find such documentation, and realize that maybe in the PerlWorld could be an answer to speed things up. NOTE: (Sun-JAVA was not selected for several reasons) Information toolbox: http://jakarta.apache.org http://www.alphaworks.ibm.com/tech/xml4j http://mis105.mis.udel.edu/ja-sig/uportal/index.html http://hsqldb.sourceforge.net/hsqldb_links.html Suggestions are welcomed. --as/Loyola University Chicago Kevin Meltzer [EMAIL PROTECTED] 10/17/01 06:07PM Hi Art, What exactly are you looking for? You can look at the documentation for XML::Parser, XML::Simple, or any of the other XML::* modules. There are articles relating to XML and Perl on www.xml.com, and on www.perlmonks.com (search for some XML QA). There are Perl/XML related mailing lists which you can find on lists.perl.org. Hope this helps, some more detail of what you are looking to do with Perl and XML could likely help us steer you in the right direction. Cheers, Kevin On Wed, Oct 17, 2001 at 05:18:13PM -0500, Art Saucedo ([EMAIL PROTECTED]) said something similar to: Is there such information and where can we look it up. Thanks! [EMAIL PROTECTED] -- [Writing CGI Applications with Perl - http://perlcgi-book.com] I wish there was a knob on the TV to turn up the intelligence. There's a knob called `brightness', but it doesn't work. -- Gallagher -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners-cgi 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): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners-cgi%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a month, and will be available online in the archives, and at http://beginners.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who owns this list? Who do I complain to? Casey West owns the beginners-cgi list. You can contact him at [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl/CGI beginners. 1.11 - When was this FAQ last updated? Sept 07, 2001 2 - Questions about the 'beginners-cgi' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. The topic of the list is, of course, CGI with Perl. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Non Perl/CGI questions or issues * Lemurs 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl/CGI , then it is allowed. If your question has nothing at all to do with Perl/CGI, it will likely be ignored. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: `perldoc perldoc' At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 3 - Other Resources 3.1 - What other websites may be useful to a beginner ? * Perl Home Page - http://www.perl.com * PerlMonks - http://www.perlmonks.org * Perldoc - http://www.perldoc.com * Perl Archives - http://www.perlarchives.com 3.2 - What resources may be harmful to a beginner? Beware of Perl4-like code-- You might find some script archives and unauthorized mirrors with old Perl4 versions of Selena Sol and Matt Wright scripts. Don't use those scripts. They are outdated and may even in some cases contain bugs or security problems since many may not have been updated in
need help in getting background images to show up in a cgi script
--- -- FREE Perl CGI scripts add WEB ACCESS to your POP email accounts! -- Download today!! http://www.adjeweb.com --- I have the following perl script which I'm currently using successfully. What I want to do is add a background image to the html page when it comes up, but it's not showing. Can Someone tell me what the problem is? I put the reference to the background image in the # START HTML DOCUMENT section. Admin #!/usr/bin/perl -w use 5.004; use strict; use CGI qw(:standard); use Fcntl qw(:flock); # ERROR SUBROUTINE sub bail { my $error = @_; print h1(Unexpected Error), p($error), end_html; die $error; } # LOCAL/PRIVATE STRINGS AND ARRAYS my( $WALL, $CHATNAME, $MAXSAVE, $TITLE, $HOME, $cur, @entries, $entry, ); $TITLE = Hosting Ohio Chat Server, version 1.1; $HOME = a href=http://www.hostingohio.com[main page]/a; $CHATNAME = /home/admin/hostingohio-www/chat/chatfile2; $WALL = /home/admin/hostingohio-www/balloons.jpg; $MAXSAVE = 100; # START HTML DOCUMENT print header, start_html(-title=$TITLE, -background=$WALL), h2($TITLE), ($HOME); $cur = CGI-new(); if ($cur-param(message)) { $cur-param(date, scalar localtime); @entries = ($cur); } # CHATFILE LOCK PROCEDURE open(CHANDLE, $CHATNAME) || bail(cannot open $CHATNAME: $!); flock(CHANDLE, LOCK_EX) || bail(cannot flock $CHATNAME: $!); while (!eof(CHANDLE) @entries $MAXSAVE) { $entry = CGI-new(\*CHANDLE); push @entries, $entry; } seek(CHANDLE, 0, 0) || bail(cannot rewind $CHATNAME: $!); foreach $entry (@entries) { $entry-save(\*CHANDLE); } truncate(CHANDLE, tell(CHANDLE)) || bail(cannot truncate $CHATNAME: $!); close(CHANDLE) || bail(cannot close $CHATNAME: $!); # FORM DATA print hr, start_form; print p(Nick:, $cur-textfield(-NAME = name)); print p(Say:, $cur-textarea(-NAME = message, -OVERRIDE = 1, -ROWS = 5, -COLUMNS = 50)); print p(submit(Send/Refresh), reset(Start Over)); print end_form, hr; # PRINTED CHAT HISTORY print h3(Last Said:); foreach $entry (@entries) { printf(%s [%s], $entry-param(date), $entry-param(name)); print p(); printf(%s, $entry-param(message)); print p(); print hr; } print end_html; [EMAIL PROTECTED] www.hostingohio.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Test if first character of a variable is a 0 (zero)
-Original Message- From: Rene Verharen [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 4:43 PM To: Beginners-CGI List Subject: Test if first character of a variable is a 0 (zero) Hi, I need to delete the first character of a variable if this (and ONLY this) character is a 0 (zero). What I tried : $text =~ s/01/1/; $text =~ s/02/2/; $text =~ s/03/3/; etc... Not what I want, because it also deletes the 0 (zero) if it is NOT the first character. What should I use ? s/^0//; Use ^ to anchor the match to the beginning of the string. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test if first character of a variable is a 0 (zero)
try this $text =~ s/^0//; this should work, the ^ indicates that it must be the first character of the line or of the string... ~Brian Hi, I need to delete the first character of a variable if this (and ONLY this) character is a 0 (zero). What I tried : $text =~ s/01/1/; $text =~ s/02/2/; $text =~ s/03/3/; etc... Not what I want, because it also deletes the 0 (zero) if it is NOT the first character. What should I use ? Vriendelijke groet, Rene Verharen [EMAIL PROTECTED] http://www.verharen.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test if first character of a variable is a 0 (zero)
On Thu, 18 Oct 2001, Rene Verharen wrote: I need to delete the first character of a variable if this (and ONLY this) character is a 0 (zero). What I tried : $text =~ s/01/1/; $text =~ s/02/2/; $text =~ s/03/3/; etc... Not what I want, because it also deletes the 0 (zero) if it is NOT the first character. $text =~ s/^0//; -- Brett http://www.chapelperilous.net/ MMM-MM!! So THIS is BIO-NEBULATION! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parsing HTTP links
--- [EMAIL PROTECTED] wrote: Hey guys, thanks for all the help with this. I actually did mean HTML Links as I am looking to parse out specific links from an HTML file. I'm not only concerned with HTTP link (a href) but also other HTML flags. Right now I'm using HTML::SimpleLinkExtor but I'm not sure that gives me exactly what I want. Essentially what I'm trying to do is parse out all info from a web page that is in bold (btext/b). I'm going to revisit LinkExtor but if there is a better solution, I'm all ears. Greg Greg, I was playing around with a similar problem and subclassed HTML::TokeParser as HTML::TokeParser::Easy. To do what you're looking for, you could use that module and do this: #!/usr/bin/perl -w use strict; use HTML::TokeParser::Easy; my $file; { local $/; $file = DATA; } # Note: If you pass it a file name instead of the file contents, # pass the name directly and *not* as a reference!!! # see perldoc HTML::TokeParser for more info. my $p = HTML::TokeParser::Easy-new( \$file ); while ( my $token = $p-get_token ) { if ( $p-is_start_tag( $token ) and $p-return_tag( $token ) eq 'b' ) { my $bold_text = ''; $token = $p-get_token; while ( ! ( $p-is_end_tag( $token ) and $p-return_tag( $token ) eq 'b' ) ) { $bold_text .= $p-return_text( $token ); $token = $p-get_token; } print $bold_text\n; } } __DATA__ !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html head titleUntitled/title /head body h1test/h1 bThis is the first ibold/i text./b iThis should not appear./i bThis is the second bold text./b /body /html The output from the above is: This is the first ibold/i text. This is the second bold text. To use it, you would have to install HTML::TokeParser and my HTML::TokeParser::Easy module (which I just uploaded at http://www.easystreet.com/~ovid/cgi_course/downloads/Easy.pm). I haven't bothered to create a complete install package for it, so go into one of your Perl lib directories and in an HTML older (something like /usr/bin/perl/site/lib/html/) create a TokeParser directory and place Easy.pm in that directory. Full POD is included so, after you install it, you can type 'perldoc HTML::TokeParser::Easy' to see how to use it. Frankly, I think the module is a bit of a hack, but if it works... Cheers, Curtis Ovid Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) Ovid on http://www.perlmonks.org/ __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help in getting background images to show up in a cgi script
On Oct 18, 2001 at 04:14 -0400, [EMAIL PROTECTED] took the soap box and proclaimed: : : --- : -- FREE Perl CGI scripts add WEB ACCESS to your POP email accounts! : -- Download today!! http://www.adjeweb.com : --- : : I have the following perl script which I'm currently using : successfully. What I want to do is add a background image to the : html page when it comes up, but it's not showing. Can Someone tell : me what the problem is? I put the reference to the background image : in the : # START HTML DOCUMENT section. You seem to have that part right. Using the CGI module, if I print start_html( -background = foo.jpg ); it prints ?xml version=1.0 encoding=utf-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML Basic 1.0//EN http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd; html xmlns=http://www.w3.org/1999/xhtml; lang=en-USheadtitleUntitled Document/title /headbody background=foo.jpg I would venture a guess that the image you want to show isn't in the location your script thinks it is. Make sure the file that the value of $WALL refers to actually exists, also check that permissions on that file are OK. : # START HTML DOCUMENT : print header, start_html(-title=$TITLE, -background=$WALL), : h2($TITLE), ($HOME); Casey West -- Shooting yourself in the foot with Smalltalk You send the message shoot to gun, with selectors bullet and myFoot. A window pops up saying Gunpowder doesNotUnderstand: spark. After several fruitless hours spent browsing the methods for Trigger, FiringPin and IdealGas, you take the easy way out and create ShotFoot, a subclass of Foot with an additional instance variable bulletHole. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Not working in Netscape, working in IE
I am having a similar problem to one that I saw you answer in a post. I have a project where the cgi form is being displayed in Netscape as raw HTML but in IE it works fine. This CGI does not use the print enter... instead I see print qq~ If this doesn't help the beginning of where I believe the problem is goes like this: ## #Login Start Page # ## sub login_startpage { counter ($logdir/,fakecount_frontpage); counter ($logdir/,realcount_frontpage); read_file_content ($logdir/,fakecount_frontpage); if ($ENV{'HTTP_COOKIE'}) { foreach (split(/;\ /, $ENV{'HTTP_COOKIE'})) { ($cookie,$value) = split(/=/); $Cookies{$cookie} = $value; } ($un,$pw) = split(/\:/,$value); } print qq~ html head title.. Any suggestions? Jimmy Lewis Web Programmer -- IP Strategy Inc. 5353 Mission Center Road #212 San Diego, CA 92108 tel 619-308-0180 x206 fax 619-839-3652 ipstrategy.com --
Re: Read /etc/shadow...
oke thx RaFaL, I'm trying to create the web base mail, first thing to do is i'll like to create the authentication user first. ok by simple does anybody using mailman... i've been try to look at the script and i still don't understand how the mailman login to another mailserver... if anybody had the script just to login and read the /var/spool/mail please show it to me... pls... i need it so... just login and read the /var/spool/mail. thx so much before... Always be ^»_«^ H E N G K Y - Mess With The Best - - Die Like The Rest - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: need help in getting background images to show up in a cgi script
[EMAIL PROTECTED] wrote: I have the following perl script which I'm currently using successfully. What I want to do is add a background image to the html page when it comes up, but it's not showing. $WALL = /home/admin/hostingohio-www/balloons.jpg; print header, start_html(-title=$TITLE, -background=$WALL), It's not a Perl but HTML question. When a browser gets body background=/home/admin/hostingohio-www/balloons.jpg it will try to download http://www.hostingohio.com/home/admin/hostingohio-www/balloons.jpg not http://www.hostingohio.com/balloons.jpg - RaFaL Pocztarski, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Passing Variables Between Modules...
Hi, How do I get this to work? well, let's try... package main; use Simple.pm; if you define the package in the same file, you dont do 'use Simple': perl will then look in @INC for a 'Simple.pm' file, which you dont have. ALSO the syntax is 'use ModuleName' - so no '.pm' at the end! my $var = hello!; slog(This is my message: $var.); you'll only have 'slog' if you actually put the module in a seperate file and use it... otherwise you have to use a fully qualified name, say: Simple::slog( 'vars' ); package Simple; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; 'use' would be appropriate here - it will be checked at compile time. 'use' is equivalent to: BEGIN { require Module; import Module LIST; } ### perldoc -f use @ISA = qw(Exporter); @EXPORT = qw( slog ); sub slog { my $msg = @_; this will NOT do what you want if you say $foo = @bar, $foo will hold the LENGTH of the array... in your case, $msg will be '1', seeing you passed 1 string... $msg_format =~ s/(\$\w+/$1/eeg; i have NO clue what you want to do here... but there's a syntax error in there: you never finish the ( ) capturing! print $msg_format; } Instead of module Simple seeing the main variable, it's trying to display one local to it's own package. Ultimately, what I'd like to do is: ehm, no it's not... $var gets interpolated when you call the slog(This is my message: $var.); slog will only see: This is my message: hello!. as the first (and only) element of @_ - pass a localized variable to a module in a quoted string You're doing that... well, sorta... 'package Simple' is not a module, but i explained that above. if you want some more insight in how modules work, and how you should write them, perhaps my tutorial is a good place to start: http://japh.nu/index.cgi?base=tuts has a few beginners tutorials, including ones for OO programming. - the value of the quoted variable is then inserted in a message. that's no problem, see my example code below I've played around with (caller())[0], but couldn't find the magic combo. what magic combo were you looking for? ### working code ### #!/usr/bin/perl -w #ALWAYS use warnings! use strict;# ALWAYS use strict! package main; my $var = hello!; Simple::slog(This is my message: $var.); package Simple; sub slog { my ($msg) = @_; # dont forget the ( ) around $msg to force list context! print $msg; #$msg_format =~ s/(\$\w+)/$1/eeg; # this regexp is not matching! #print $msg_format; print \nI just got:\n --- $msg ---\n } hth, Jos -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XMLParser and Perl
I (a beginner in Perl) am looking for guidance on XML and Perl. I am having to read in an XML file, parse it for specific information (MIME type, attributes and values), write the attributes/values to a hash (I am assuming) and then use win32::OLE to persist the attribute/vlaues to the custom properties of a Word or Excel document. Also it would be nice to beable to determine the number of attribute/value pairs in the XML file so as to presize the hash table. Are there any example out there or code I can use to get a good start to speed up my learning curve? There is a slight time constraint I am working with. Thanks in advance Trent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Win32::Setupsup Vs Win32::GUITest -Which one is more suitable f or GUI or Functional Tesing of an application
I have an application( no code is available with me). I have to do automated GUI or Functional testing of the application. I want to use perl script for the job. There are two module available in perl Win32::GUITest and Win32::Setupsup for the job. While Win32::GUITest support the latest version of perl,Win32::Setupsup does not. You may now install Win32::Setupsup for the last version of ActivePerl by PPM from http://Jenda.Krynicky.cz/perl Which module is more suitable for the GUI or Functional testing point of view ? I need expert comment from those who have done the similar job in perl Sorry can't comment on this. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Win32::Setupsup -Can Mouse action be sent to a window as SendKeys sends some key strokes to a window
Hi All We can send some key strokes to a window by SendKeys function in Win32::Setupsup. How can we send mouse action to a window ? Is there any function available in win32::Setupsup for the mouse action job. Thanking You Abhra Debroy Prabodhan Exports Pvt. Ltd.(www.prabodhan.com - Join our QA Club!) Tel: 91-20-5462035,543 1447 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Win32::Setupsup Vs Win32::GUITest -Which one is more suitable for GUI or Functional Tesing of an application
Hi All I have an application( no code is available with me). I have to do automated GUI or Functional testing of the application. I want to use perl script for the job. There are two module available in perl Win32::GUITest and Win32::Setupsup for the job. While Win32::GUITest support the latest version of perl,Win32::Setupsup does not. Also I understand that Win32::Setupsup is having more number of function available with it than Win32::GUITest. Which module is more suitable for the GUI or Functional testing point of view ? I need expert comment from those who have done the similar job in perl . Thanking In advance for the help Abhra Debroy Prabodhan Exports Pvt. Ltd.(www.prabodhan.com ) Tel: 91-20-5462035,543 1447 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Warnings with strict and POSIX
I'm not sure exactly whats going on here. It seems the combination of strict and POSIX :sys_wait_h is fine... but just POSIX seems to stop the strict bareword warnings. Any idea whats going on here? (exporter wierdness?) #!/usr/bin/perl -w use POSIX; #use POSIX :sys_wait_h; use strict; sysopen(FILE,somefile.txt, O_WRONLY | O_APPEND | O_CREAT,0664); close(FILE); -Joshua Hoblitt -- [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:Dns and gethostbyaddr in Perl
Hi, I parse a log file in Perl Tk and I have for exemple this line: LOG_INFO : cabs41.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success I have 2 labels to display the informations: in one I put cabs41.col.bsf.alcatel.fr in another I put only cabs41 My code is open FILE, $_Globals{SYSLOG} or die $!; while (FILE) { if (/([0-9a-z:]+)\s*via eth0/) { $_Globals{MAC_ADDR} = $1; } elsif (/read request for/) { ($_Globals{IP_ADDR}, $_Globals{INSTALL_FILE}) = m[:\s*(\S+):.+?(/\S+):]; ($_Globals{CLIENT_NAME}) = $_Globals{IP_ADDR} =~ /^(\w+)/; #$nom = gethostbyaddr(inet_aton($_Globals{CLIENT_NAME}),AF_INET) #or die je ne peux résoudre $_Globals{CLIENT_NAME} :$!\n; ($_Globals{BOOT_FILE}) = $_Globals{INSTALL_FILE} =~ /([\w.]+)$/; } } close FILE; but sometines I don't have the Dns informations and I can have: :192.40.54.42: read request for /bootp/linux/pre2.2/linux.ram: success (Cygwin) so my first label will display 192.40.54.42 but my second will display only 192 which is a nonsense. How can i do to retrieve from the ip address the name which corresponds if it is neccesary. with gethostbyaddr for example. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Little help on hashes
Hello all, I hope you can help, I have the following information Happy,[EMAIL PROTECTED], manager, $2 Bob, [EMAIL PROTECTED], manager, $35000 Jim, [EMAIL PROTECTED], manager, $5 Charles, [EMAIL PROTECTED], sales, $28000 Ann, [EMAIL PROTECTED], sales, $29000 How would I load the above into hashes? How would I sort the information by position in company? How would perform a simple task sush as the average salary for the managers? Please, if anyone could help Regards Dominic -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Factory method
I'm working through the design patterns book with some Java colleagues, trying to present Perl equivalents of their Java code - I call it pattern-oriented Perl ;) At the moment, we're discussing the Factory method, and I've put together some sample code here: http://www.perfascist.com/factory.tar.gz I've built a test application (factory/test_list.pl), which sets up and calls some methods on two objects from the base class List (code for the List class is in factory/List.pm). In this particular example, the test script calls an object method 'content' which either lists a directory or lists a file, depending on what type of List object is instantiated. The List class is nothing but a placeholder for its subclasses. When it's constructor method (sub new) is called, it creates an instance of one of its subclasses, the choice of subclass being based on one of the arguments to the constructor method. Thereafter, all calls to the List object redirect arguments to the subclass. Inside the subclasses (List::Directory in factory/List/Directory.pm and List::File in factory/List/File.pm), the methods are written as if they were being called directly, thereby ignoring the existence of a base class. Is this the factory method, or am I deluding myself? Does anyone have any decent links for design patterns in Perl? --Nigel Wetters _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Little help on hashes
Hi, Hello all, I hope you can help, I have the following information Happy,[EMAIL PROTECTED], manager, $2 Bob, [EMAIL PROTECTED], manager, $35000 Jim, [EMAIL PROTECTED], manager, $5 Charles, [EMAIL PROTECTED], sales, $28000 Ann, [EMAIL PROTECTED], sales, $29000 How would I load the above into hashes? depends on how you want it in a hash if you'd want the keys to be their names, and the value an array ref of email, position and salary, this would work: my $hash; while(INPUTFILE){ my @list = split ','; $hash-{ shift @list } = \@list; } How would I sort the information by position in company? you probably want to look at the 'schwartzian transform' anyway, you can look this up in perlfaq 4, in the sub section How do I sort an array by (anything)? How would perform a simple task sush as the average salary for the managers? add all the salaries together and devide them by the number of managers. an example (assuming we did the 'hashing' as in my previous example) my $cnt; my $total; for my $key ( %$hash ) { if ( $hash-{$key}-[1] eq 'manager' ) { # the emp type $total += $hash-{$key}-[2];# the salary ++$cnt;# the count next; } } print The average salary is: , $total/$cnt, \n; Please, if anyone could help Regards Dominic i have to say i didnt run the code, but the example should be fairly obvious i think good luck, Jos -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Unix command in a Perl script
I think I may have seen this one before myself. If I'm right, you'll need to correctly quote the quotation marks inside your variable which has the email addresses. You have to get the command to have the quotes if you print it out to standard output. For example: $alert_email_address = \foo\@bar.com foo2\@bar.net\ mailto:foo2\@bar.net\ ; Essentially, your just escaping the quotes so that if you print $alert_email_address to standard output you get quotes printed: mailto:'[EMAIL PROTECTED] [EMAIL PROTECTED]' '[EMAIL PROTECTED] [EMAIL PROTECTED]' and not: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -Original Message- From: Mark Sheinbaum [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 8:40 PM To: 'Mike Rapuano'; 'Brett W. McCoy' Cc: 'Perl Beginners (E-mail)' Subject: RE: unix command in a perl script Don't these require installation on your server? If yes, I'm not authorized to do that. So, back to my original question... How to enter multiple destinations when running mailx from a perl script? Thanks again. Mark -Original Message- From: Mike Rapuano [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, October 17, 2001 2:48 PM To: Brett W. McCoy; Mark Sheinbaum Cc: Perl Beginners (E-mail) Subject: RE: unix command in a perl script Here are some other mail modules I like: Net::Smtp or Mail::Sender have fun Mike -Original Message- From: Brett W. McCoy Sent: Wed 10/17/2001 5:40 PM To: Mark Sheinbaum Cc: Perl Beginners (E-mail) Subject: Re: unix command in a perl script On Wed, 17 Oct 2001, Mark Sheinbaum wrote: I want to send email from a pl script using mailx. I'm having problems adding multiple destinations.Only 1 destination is receiving the email. I suspect the problem has to do with the quoting rules. Here's an example. Any help would be much appreciated. $alert_email_address = foo\@bar.com foo2\@bar.net; if ($alert_cnt 0) { $subject = Alerts; $file_name = alert.rpt; $result = `mailx -s $subject $alert_email_address $file_name`; } There are better ways to accomplish this. Have you looked at the Mail::Mailer CPAN module? It'll make your life a little easier. -- Brett http://www.chapelperilous.net/ http://www.chapelperilous.net/ Did you know the University of Iowa closed down after someone stole the book? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Image/Photo ?
Hi, I've built my own Programmlauncher (App which reads an rc-file and creates depending buttons), and now I want to place an Icon on the left side of the Buttons. I tried something like $icon1 = $mw-Photo(-file=my.xpm)-pack; but that didn't work (couldn't open file in mode 'r'). Could anybody please send me a piece of code? Best regards, Mennowar -- Dummheit ist die einzige natürliche Begabung des Menschen. - Wilhelm Busch - _ Downloaden Sie MSN Explorer kostenlos unter http://explorer.msn.de/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
I Want To Read (INPUT) A TCP (Port80) Session - Then Mail That Report
Simple (Probably VERY Trivial To Ya'll ) I merely want to send TWO lines to a remote host (via the Telnet program, OR if there is an easier way), with the information that's returned to be collected to a file. (I'm creating reports from a web-server - and would like to send TWO LINES to THAT server, and 'read' the results.) i.e. If I did this: $ telnet (space) h.o.s.t/ip (space) port#80 (What gets returned is:) Connected to blah.blah Escape character is '^]'. (then, if I send:) get url http/1.1 (lf) accept blah..blah.. (lf) the web-server then sends the report/pages (in html format, of course) that would normally be displayed to a web-browswer. It is THIS text that I wish to capture to a file. (Sorry, I know it may be very trivial for MOST of you, I apologize, but I'm bound and determined to keep at it, and *GOING* to Learn (The Kewlest!) Perl!) Any help? William A Fink - Network Engineer - NUWC Solaris/Unix/Linux/Win9x/Win2K/WinME/Novell/CiscoIOS Instructor/Certifications: MCSE Networking Essentials Linux+/Network+/A+(99/01)/INet+/Intra-Internet/Web Security William A Fink - Network Engineer - NUWC Solaris/Unix/Linux/Win9x/Win2K/WinME/Novell/CiscoIOS Instructor/Certifications: MCSE Networking Essentials Linux+/Network+/A+(99/01)/INet+/Intra-Internet/Web Security -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I Want To Read (INPUT) A TCP (Port80) Session - Then Mail That Report
Bill Fink wrote: Simple (Probably VERY Trivial To Ya'll ) I merely want to send TWO lines to a remote host (via the Telnet program, OR if there is an easier way), with the information that's returned to be collected to a file. (I'm creating reports from a web-server - and would like to send TWO LINES to THAT server, and 'read' the results.) What you need here is LWP::Simple module. Just say: use LWP::Simple; $page = get 'http://dev.perl.org/'; and you have the HTML page in $page variable. Thet works even with proxies, really great module. See: http://www.linpro.no/lwp/ http://www.perldoc.com/perl5.6/lib/LWP.html http://search.cpan.org/search?dist=libwww-perl - RaFaL Pocztarski, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:Data structure for handling Binary Data
Hi, you can use two package: Socket, and Net::RawIP (needs libpcap); With Net::RawIP you can built packet (ip,udp,tcp) how you want and to analize the packet. Ex. use Net::RawIP qw(:pcap); use Socket; $a=new Net::RawIP; $|=1; $filtro='ip proto \\tcp and (dst host '.$host.' or src host '.$host.')'; ##$host is a variabile that contains the host in dot , or simbolic nane notation $tout=60; $size=1500; $pcap=$a-pcapinit('eth0',$filtro,$size,$tout); $offset=linkoffset($pcap); for(;;){ $pc=next($pcap,$t); if($pc){ $a-bset(substr($pc,$offset)); ##you can read the packet; ($ipsg)=$a-get({ip=['saddr']}); ##(IP address source) $ipsg=inet_ntoa(pack(N,$ipsg)); ## Trasform the bynary pack in a dot notation ($ipdst)=$a-get({ip=['daddr']}); ##(IP address destination) $ipdst=inet_ntoa(pack(N,$ipdst)); ($portsg)=$a-get({tcp=['source']}); #port source ($portdst)=$a-get({tcp=['dest']}); ## port destination ($syn)=$a-get({tcp=['syn']}); #es: rst,ack,psh ($seq)=$a-get({tcp=['seq']}); ###seq number $seq=sprintf(%u,$seq); ## ($ack_seq)=$a-get({tcp=['ack_seq']}); ### ack number $ack_seq=sprintf(%u,$ack_seq); ($data)=$a-get({tcp=['data']}); ### data $d1=substr $data,0,1##extract the first byte ($h1)=unpack(H2,$d1); ##convert in HEX format } } you can built packet es: $b=new Net::RawIP; $b-set(ip={saddr=$sip,daddr=$dip},tcp={source=$ports,dest=$ports,ack=1,syn=,seq=$x,ack_seq=$y,data=$dt}}); $b-send; Bye I was wondering if any of you guys could help me out with some insight on building a data structure for sending and receiving binary data. Here is what I am doing: 1. building a tcp client to query a server with data 2. the client sends the binary data stream, and then receives binary data stream from server, and closes the socket 3. I would like to be able to build a structure where I can modify certain bytes (whether decimal, hex, or binary) before sending the stream, such as to create a message, and then sending the message to the server. 4. When the message is received, I would like to be able to read it into an ordered structure so that I can retrieve certain bits after I have decoded the stream into decimal or hex ASCII representations. For example, my packet sniffer is showing the following: : 000a c844 f00a 0401 0008 0009 c844 ...D...D 0010: f00b 07c8 4080 00dc a000 ..@. I need to read each one of these bytes in a de-limited way. Has anyone done this before or can give me any kind of insight? Is there another list that would be better for this? I would GREATLY appreciate any and all insight. Thanks, Jason O. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
BETWEEN Comparison Operator
Hi, very simple question here I think. Trying to get an IF to test whether a numeric variable is in a certain range if it is then execute an action : if ($variable -10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }elsif ($variable 10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }else { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; } I can only seem to do this with 2 conditional statements(IF ELSIF) and the action repeated. What I want is a Between operator for the range -10 to 10. Any ideas, Mark _ Mark Martin Computer Centre National University of Ireland Maynooth Tel: (01)708 4716/3830 Fax: (01)628 6249 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Factory method
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: http://www.perfascist.com/factory.tar.gz couldn't find this domain *shrug* The List class is nothing but a placeholder for its subclasses. When it's constructor method (sub new) is called, it creates an instance of one of its subclasses, the choice of subclass being based on one of the arguments to the constructor method. Is this the factory method, or am I deluding myself? Does anyone have any decent links for design patterns in Perl? this is a factory since it creates objects in other packages. :) -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
symbolic reference of hashes in subroutines
I figured this one out using the camel book and brute force methods. But if anyone could shed some light on symbolic references of the hash arrays I would appreciate it. Specifically, in the subroutine below populate_hash(), the line: ${%{$hash}}{$key} = $value; Seems kind of ugly saying heres a reference, really it's a hash, go ahead and put a new key/value pair in, cause I know it's a hash. Is this the correct way of doing this? Thanks in advance, Ross #!/usr/local/bin/perl -w # Undefining the variables to be used as hash array undef $hash1; undef $hash2; # Insertting some values just to start things off $hash1{KEY0} = value0; $hash2{DOWAP} = DOWAH; # Populating each hash with more values using a subroutine populate_hash (\%hash1, HEY1, value1); populate_hash (\%hash2, HUMM, HAH); # Outputting the hash contents for first array foreach $key (keys %hash1) { print hash1 $key - $hash1{$key}\n; } # Outputting the hash contents for second array foreach $key (keys %hash2) { print hash2 $key - $hash2{$key}\n; } exit; # Simple subroutine to populate a passed hash array with values sub populate_hash ($$\%) { my $hash = $_[0]; my $key = $_[1]; my $value = $_[2]; ${%{$hash}}{$key} = $value; } _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BETWEEN Comparison Operator
If (($x-10) ($x10)){ ##cod to execute } Bye Hi, very simple question here I think. Trying to get an IF to test whether a numeric variable is in a certain range if it is then execute an action : if ($variable -10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }elsif ($variable 10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }else { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; } I can only seem to do this with 2 conditional statements(IF ELSIF) and the action repeated. What I want is a Between operator for the range -10 to 10. Any ideas, Mark _ Mark Martin Computer Centre National University of Ireland Maynooth Tel: (01)708 4716/3830 Fax: (01)628 6249 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BETWEEN Comparison Operator
Hi, The following if checks for variable between -10 and 10. if ( $variable -10 and $variable 10 ) { # do something } The example you gave looks like it always executes though, so maybe I'm missing something. --Paul -Original Message- From: Mark Martin [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 10:31 AM To: [EMAIL PROTECTED] Subject: BETWEEN Comparison Operator Hi, very simple question here I think. Trying to get an IF to test whether a numeric variable is in a certain range if it is then execute an action : if ($variable -10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }elsif ($variable 10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }else { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; } I can only seem to do this with 2 conditional statements(IF ELSIF) and the action repeated. What I want is a Between operator for the range -10 to 10. Any ideas, Mark _ Mark Martin Computer Centre National University of Ireland Maynooth Tel: (01)708 4716/3830 Fax: (01)628 6249 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: symbolic reference of hashes in subroutines
i must be missing the point, but why are you using prototyped subroutines to populate a hash ref? what's wrong with: my $href = { foo = 'quux', bar = [ qw( bleh yuck) ], }; or $href-{'baz'} = { foo = 'bar' } ? regards, Jos - Original Message - From: Ross Howard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 18, 2001 3:33 PM Subject: symbolic reference of hashes in subroutines I figured this one out using the camel book and brute force methods. But if anyone could shed some light on symbolic references of the hash arrays I would appreciate it. Specifically, in the subroutine below populate_hash(), the line: ${%{$hash}}{$key} = $value; Seems kind of ugly saying heres a reference, really it's a hash, go ahead and put a new key/value pair in, cause I know it's a hash. Is this the correct way of doing this? Thanks in advance, Ross #!/usr/local/bin/perl -w # Undefining the variables to be used as hash array undef $hash1; undef $hash2; # Insertting some values just to start things off $hash1{KEY0} = value0; $hash2{DOWAP} = DOWAH; # Populating each hash with more values using a subroutine populate_hash (\%hash1, HEY1, value1); populate_hash (\%hash2, HUMM, HAH); # Outputting the hash contents for first array foreach $key (keys %hash1) { print hash1 $key - $hash1{$key}\n; } # Outputting the hash contents for second array foreach $key (keys %hash2) { print hash2 $key - $hash2{$key}\n; } exit; # Simple subroutine to populate a passed hash array with values sub populate_hash ($$\%) { my $hash = $_[0]; my $key = $_[1]; my $value = $_[2]; ${%{$hash}}{$key} = $value; } _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Factory method
Sorry, typo: http://www.perlfascist.com/factory.tar.gz I've already amended the example to include some comments made by people who found my site despite my best efforts! Still looking for sites that have any information about design patterns in perl. Anyone seen any? --Nigel Wetters _brian_d_foy wrote: http://www.perfascist.com/factory.tar.gz couldn't find this domain *shrug* _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BETWEEN Comparison Operator
The code if ( $variable -10 and $variable 10 ) { # do something } Will not catch -10 itself or 10, so this is really like saying from -9 to 9. If you want to include -10 and 10, use this if ( $variable = -10 and $variable = 10 ) { # do something } But yeah, it looks like this code always executes the statement anyways. Brian Arnold [EMAIL PROTECTED] -Original Message- From: Heely, Paul [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 9:40 AM To: 'Mark Martin'; [EMAIL PROTECTED] Subject: RE: BETWEEN Comparison Operator Hi, The following if checks for variable between -10 and 10. if ( $variable -10 and $variable 10 ) { # do something } The example you gave looks like it always executes though, so maybe I'm missing something. --Paul -Original Message- From: Mark Martin [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 10:31 AM To: [EMAIL PROTECTED] Subject: BETWEEN Comparison Operator Hi, very simple question here I think. Trying to get an IF to test whether a numeric variable is in a certain range if it is then execute an action : if ($variable -10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }elsif ($variable 10) { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; }else { $sth1-execute($variable) or die Can't execute SQL statement: $DBI::errstr\n; } I can only seem to do this with 2 conditional statements(IF ELSIF) and the action repeated. What I want is a Between operator for the range -10 to 10. Any ideas, Mark _ Mark Martin Computer Centre National University of Ireland Maynooth Tel: (01)708 4716/3830 Fax: (01)628 6249 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: symbolic reference of hashes in subroutines
I'm actually just using this as a simplistic example, and it's a very simple example, which as you pointed out has a simpler alternative. What I am trying to obtain is an explanation as to how hashes can be passed to a subroutine, populated and used within a subroutine, and used external to the subroutine with the data from the subroutine. Specifically, the line: ${%{$hash}}{$key} = $value; ^^^ This is the part I am not 100% clear on. R From: Jos I. Boumans [EMAIL PROTECTED] To: Ross Howard [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: symbolic reference of hashes in subroutines Date: Thu, 18 Oct 2001 15:49:21 +0200 i must be missing the point, but why are you using prototyped subroutines to populate a hash ref? what's wrong with: my $href = { foo = 'quux', bar = [ qw( bleh yuck) ], }; or $href-{'baz'} = { foo = 'bar' } ? regards, Jos - Original Message - From: Ross Howard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 18, 2001 3:33 PM Subject: symbolic reference of hashes in subroutines I figured this one out using the camel book and brute force methods. But if anyone could shed some light on symbolic references of the hash arrays I would appreciate it. Specifically, in the subroutine below populate_hash(), the line: ${%{$hash}}{$key} = $value; Seems kind of ugly saying heres a reference, really it's a hash, go ahead and put a new key/value pair in, cause I know it's a hash. Is this the correct way of doing this? Thanks in advance, Ross #!/usr/local/bin/perl -w # Undefining the variables to be used as hash array undef $hash1; undef $hash2; # Insertting some values just to start things off $hash1{KEY0} = value0; $hash2{DOWAP} = DOWAH; # Populating each hash with more values using a subroutine populate_hash (\%hash1, HEY1, value1); populate_hash (\%hash2, HUMM, HAH); # Outputting the hash contents for first array foreach $key (keys %hash1) { print hash1 $key - $hash1{$key}\n; } # Outputting the hash contents for second array foreach $key (keys %hash2) { print hash2 $key - $hash2{$key}\n; } exit; # Simple subroutine to populate a passed hash array with values sub populate_hash ($$\%) { my $hash = $_[0]; my $key = $_[1]; my $value = $_[2]; ${%{$hash}}{$key} = $value; } _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BETWEEN Comparison Operator
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Mark Martin) wrote: I can only seem to do this with 2 conditional statements(IF ELSIF) and the action repeated. What I want is a Between operator for the range -10 to 10. Any ideas, Perl 6 will have this. patience :) -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tk::Button -underline not working?
Hello, I'm trying to use the -underline option on a Button in a Tk::NoteBook to implement keyboard mapping. The character appears underlined, but the callback function is not called. Am I missing somthing? (I've tried anonymous callbacks as well). Code Begin... use Tk; require Tk::NoteBook; sub bail{ exit; }; $mw = MainWindow-new; $mw-title(NoteBook Widget Test); $f = $mw-NoteBook(); $page1 = $f-add(page1, -label = page1); $page1-Button(-text = Exit, -underline = 0, -command = \bail )-pack(-side = 'bottom'); $p1_label1 = $page1-Label(-text = This is page number 1, -highlightbackground = yellow )-pack(-side = 'top', -anchor = 'n'); $page1-Button(-text = Select Page 1, -command = sub { $f-raise(page1); } )-pack(-side = 'left'); $page1-Button(-text = Select Page 2, -command = sub { $f-raise(page2); } )-pack(-side = 'left'); $page1-Button(-text = Select Page 3, -command = sub { $f-raise(page3); } )-pack(-side = 'left'); $page1-Button(-text = Select Page 4, -command = sub { $f-raise(page4); } )-pack(-side = 'left'); $page2 = $f-add(page2, -label = page2); $page3 = $f-add(page3, -label = page3); $page4 = $f-add(page4, -label = page4); $f-pack(); MainLoop; Code End... Thanks in advance, == Powell E. Barber, Sr. Engineer 850.644.6477 voice Department of Nuclear Services 850.644.9848 fax Florida State University Tallahassee FL 32306-4470 [EMAIL PROTECTED] http://nucalf.physics.fsu.edu/~barber -- When you've got a Chautauqua in your head, it's extremely hard not to inflict it on innocent people. R. M. Pirsig == -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file:
On Wed, 17 Oct 2001, AMORE,JUAN (HP-Roseville,ex1) wrote: #!/usr/bin/perl -w my $function = shift @ARGV; if( $function =~ /add/ ) { $rtn = add( @ARGV ); print The sum is :$rtn; } elsif( $function =~ /multiply/ ) { $rtn = multiply( @ARGV ); print The product is :$rtn; } sub add { my @list = @_; my $sum = 0; $sum += $_ foreach (@list); } # = This was missing sub multiply { my @list = @_; my $prod = 1; $prod *= $_ foreach (@list); } Dave Storrs -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
newbie cgi problem
I'm trying to print the contents of a file which is being passed from a html form. I'm pretty close (I think). Here's what I have... html form... form method=post action=/cgi-bin/smsconfview.pl Enter the hostname to view the configuraqtion file br input size=50 name=host brbr input type =submit value=submit perl script... #!/usr/local/bin/perl -w use CGI qw(:all); $s=CGI::param('host'); $s = quotemeta($s); print header; print start_html(); open(CONF, /opt/disk4/REDBACK-BACKUP/$s) or die(configuration file not found); @t=CONF; close(CONF); foreach (@t) { print $_BR }; print end_html(); Here are the errors... String found where operator expected at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print (Might be a runaway multi-line string starting on line 7) (Missing semicolon on previous line?) syntax error at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print In string, @t now must be written as \@t at /usr/local/apache/cgi-bin/smsconfview.pl line 7, near ; @t Scalar found where operator expected at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print $_ (Do you need to predeclare foreach?) Can't find string terminator '' anywhere before EOF at /usr/local/apache/cgi-bin/smsconfview.pl line 10. httpd: [Thu Oct 18 14:47:10 2001] [error] [client 155.251.65.70] Premature end of script headers: /usr/local/apache/cgi-bin/smsconfview.pl Any suggestions? dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie cgi problem
try this.. foreach (@t) { print $_BR; }; On Thu, 2001-10-18 at 10:54, dan radom wrote: I'm trying to print the contents of a file which is being passed from a html form. I'm pretty close (I think). Here's what I have... html form... form method=post action=/cgi-bin/smsconfview.pl Enter the hostname to view the configuraqtion file br input size=50 name=host brbr input type =submit value=submit perl script... #!/usr/local/bin/perl -w use CGI qw(:all); $s=CGI::param('host'); $s = quotemeta($s); print header; print start_html(); open(CONF, /opt/disk4/REDBACK-BACKUP/$s) or die(configuration file not found); @t=CONF; close(CONF); foreach (@t) { print $_BR }; print end_html(); Here are the errors... String found where operator expected at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print (Might be a runaway multi-line string starting on line 7) (Missing semicolon on previous line?) syntax error at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print In string, @t now must be written as \@t at /usr/local/apache/cgi-bin/smsconfview.pl line 7, near ; @t Scalar found where operator expected at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print $_ (Do you need to predeclare foreach?) Can't find string terminator '' anywhere before EOF at /usr/local/apache/cgi-bin/smsconfview.pl line 10. httpd: [Thu Oct 18 14:47:10 2001] [error] [client 155.251.65.70] Premature end of script headers: /usr/local/apache/cgi-bin/smsconfview.pl Any suggestions? dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richie Crews Unix Administrator / Internet Integrator Email: [EMAIL PROTECTED] Cell: (706) 773 - 3436 Desk: (706) 634 - 3681 Fax: (706) 634 - 3831 When I take action, I'm not going to fire a $2 million missile at a $10 empty tent and hit a camel in the butt. It's going to be decisive. - President George W. Bush -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: newbie cgi problem
Hi, open(CONF, /opt/disk4/REDBACK-BACKUP/$s) or die(configuration file not found); ^ Try getting rid of the extra on line 7. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XMLParser and Perl
Go to http://search.cpan.org/ and type XML into the search box. There are a whole bunch of XML modules that will make your life much easier. In general, go to CPAN and look for a module is the answer to most problems in Perl...the number of modules is HUGE, and no matter what you need, there is probably a module that can help. Always check CPAN before writing it yourself. Dave On Thu, 18 Oct 2001, Trent A Stephens wrote: I (a beginner in Perl) am looking for guidance on XML and Perl. I am having to read in an XML file, parse it for specific information (MIME type, attributes and values), write the attributes/values to a hash (I am assuming) and then use win32::OLE to persist the attribute/vlaues to the custom properties of a Word or Excel document. Also it would be nice to beable to determine the number of attribute/value pairs in the XML file so as to presize the hash table. Are there any example out there or code I can use to get a good start to speed up my learning curve? There is a slight time constraint I am working with. Thanks in advance Trent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie cgi problem
thanks too all who replied. i knew i was close. i can't believe i missed the extra on line 7. duh. thanks everyone! dan * dan radom ([EMAIL PROTECTED]) wrote: I'm trying to print the contents of a file which is being passed from a html form. I'm pretty close (I think). Here's what I have... html form... form method=post action=/cgi-bin/smsconfview.pl Enter the hostname to view the configuraqtion file br input size=50 name=host brbr input type =submit value=submit perl script... #!/usr/local/bin/perl -w use CGI qw(:all); $s=CGI::param('host'); $s = quotemeta($s); print header; print start_html(); open(CONF, /opt/disk4/REDBACK-BACKUP/$s) or die(configuration file not found); @t=CONF; close(CONF); foreach (@t) { print $_BR }; print end_html(); Here are the errors... String found where operator expected at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print (Might be a runaway multi-line string starting on line 7) (Missing semicolon on previous line?) syntax error at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print In string, @t now must be written as \@t at /usr/local/apache/cgi-bin/smsconfview.pl line 7, near ; @t Scalar found where operator expected at /usr/local/apache/cgi-bin/smsconfview.pl line 10, near foreach (@t) { print $_ (Do you need to predeclare foreach?) Can't find string terminator '' anywhere before EOF at /usr/local/apache/cgi-bin/smsconfview.pl line 10. httpd: [Thu Oct 18 14:47:10 2001] [error] [client 155.251.65.70] Premature end of script headers: /usr/local/apache/cgi-bin/smsconfview.pl Any suggestions? dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unable to display output
On Wed, 17 Oct 2001, nafiseh saberi wrote: in perl , if u want see in screen must write : print \n; before things you want to to print. I mean that you must print one empty line and then print things u wants __ Best regards . Nafiseh Saberi Um, what? Maybe I'm misunderstanding you, but it simply isn't true that you must print an empty line before you can print data to the screen. Here are two ways to prove this to yourself: From the command line: perl -e 'print Hello, World!'; Or, put the following in a file: #!/usr/bin/perl print Hello, World!; Make sure execute permissions are set on the file, then run the file. You will notice that neither of these examples includes a newline (\n) anywhere, yet they still print to the screen. Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie cgi problem
On Thu, 18 Oct 2001, dan radom wrote: I'm trying to print the contents of a file which is being passed from a html form. I'm pretty close (I think). Here's what I have... #!/usr/local/bin/perl -w You should also have 'use strict' here. use CGI qw(:all); $s=CGI::param('host'); $s = quotemeta($s); print header; print start_html(); open(CONF, /opt/disk4/REDBACK-BACKUP/$s) or die(configuration file not found); ---^ You have an extra quote here This is why you are getting unterminated string errors. @t=CONF; Grabbing up a file into an array isn't always a good idea. You should do: while(CONF) { print $_BR; } close(CONF); foreach (@t) { print $_BR }; print end_html(); -- Brett http://www.chapelperilous.net/ This is clearly another case of too many mad scientists, and not enough hunchbacks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
hash access issue
Hi there, Here is my dilema: %HoH = ( flintstones = { lead1 = fred, pal1 = barney, }, jetsons = { lead2 = george, wife2 = jane, his boy3 = elroy, }, simpsons= { lead3 = homer, wife3 = marge, kid3 = bart, }, ); $HoH{$key1}{$key2} is the basic structure of my hash. while I am reading from another file that provides 3 variables if $var1 eq flintsones and $var2 eq pal1, then: $HoH{$var1}{$var2} = barney. Is ther a way that if $var1 eq anything and $var2 eq pal1 I can still get barney. Any help is highly appreciated I.S __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: socket closed
-Original Message- From: Daniel Gardner [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 6:50 PM To: [EMAIL PROTECTED] Subject: socket closed Hi, i have code that looks something like this: my $sock = IO::Socket::INET-new(%args); my $sel = new IO::Select $sock; while (1) { my @ready = IO::Select-can_read(1); foreach my $socket (@ready) { # read a line my $line = $socket; do_stuff_with_line($line); } # end foreach # do other stuff } # end while which works just great, except for when the remote server closes the connection on the socket i've opened. IO::Select seems to return the handle as being ready to read from, and $socket immediately returns undef. so my question is, how do i tell if the remote server has closed the connection? That's how you tell. when $socket returns undef, that means you've hit end of file, which on a socket means the other end has closed. At that point, just break out of your loop. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: hash access issue
You could probably do something like sub checkanything { my $var2 = shift; foreach (keys %HoH) { return $HoH{$_}{$var2} if $HoH{$_}{$var2}; } } Then in your main body of code, just say something like if ($var1 eq anything) { $return = checkanything($var2); } I think that should do it - good luck =) Brian Arnold [EMAIL PROTECTED] -Original Message- From: F.H [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 11:59 AM To: [EMAIL PROTECTED] Subject: hash access issue Hi there, Here is my dilema: %HoH = ( flintstones = { lead1 = fred, pal1 = barney, }, jetsons = { lead2 = george, wife2 = jane, his boy3 = elroy, }, simpsons= { lead3 = homer, wife3 = marge, kid3 = bart, }, ); $HoH{$key1}{$key2} is the basic structure of my hash. while I am reading from another file that provides 3 variables if $var1 eq flintsones and $var2 eq pal1, then: $HoH{$var1}{$var2} = barney. Is ther a way that if $var1 eq anything and $var2 eq pal1 I can still get barney. Any help is highly appreciated I.S __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: symbolic reference of hashes in subroutines
Ross Howard wrote: Specifically, the line: ${%{$hash}}{$key} = $value; ^^^ This is the part I am not 100% clear on. $hash is a hash reference, right? Then try: $hash-{$key} = $value; - RaFaL Pocztarski, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Warnings with strict and POSIX
-Original Message- From: josh hoblitt [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 5:01 AM To: [EMAIL PROTECTED] Subject: Warnings with strict and POSIX I'm not sure exactly whats going on here. It seems the combination of strict and POSIX :sys_wait_h is fine... but just POSIX seems to stop the strict bareword warnings. Any idea whats going on here? (exporter wierdness?) #!/usr/bin/perl -w use POSIX; #use POSIX :sys_wait_h; use strict; sysopen(FILE,somefile.txt, O_WRONLY | O_APPEND | O_CREAT,0664); close(FILE); use POSIX; basically brings in the default set of symbols into your name space (i.e. those defined in @EXPORT). use POSIX qw(:foo) calls on an export tag which typically will import a basket of symbols (although the arguments passed to import can do other things besides importing symbols). So use POSIX qw(:sys_wait_h) is evidently importing O_WRONLY, etc. into your namespace so use strict doesn't complain. You can always access the symbols even if they aren't imported, as POSIX::O_WRONLY for example. Look at the docs for use and Exporter for the full poop. BTW, those symbols are typically imported using the Fcntl module, if I'm not mistaken. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: symbolic reference of hashes in subroutines
That's definately alot easier to read and understand! Thanks R From: RaFaL Pocztarski [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: symbolic reference of hashes in subroutines Date: Thu, 18 Oct 2001 18:10:18 +0200 Ross Howard wrote: Specifically, the line: ${%{$hash}}{$key} = $value; ^^^ This is the part I am not 100% clear on. $hash is a hash reference, right? Then try: $hash-{$key} = $value; - RaFaL Pocztarski, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Elusive Syntax
Anyone know how I can do this? I can't seem to get past a syntax error near the 'while'. (it worked up to the point I tried to put it into a table, and the table works fine by itself) use CGI qw/:standard *table start_ul/; require DBI; require HTTP::Date; . print table({-border=undef}, caption('Contacts'), Tr({-align=CENTER,-valign=TOP}, [ th(['First Name','Last Name','Title','Company','Work Ph.','Home Ph.', 'Fax Number','Other Ph.','Email Addr.','City','Prov.','Postal', 'Country','Custom 1','Custom 2','Custom 3','Custome 4','Notes', 'Category']), while ( @columns = $cursor-fetchrow ) { td([ '$columns[0]', '$columns[1]', '$columns[2]', '$columns[3]', '$columns[4]', '$columns[5]', '$columns[6]', '$columns[7]', '$columns[8]', '$columns[9]', '$columns[10]','$columns[11]', '$columns[12]','$columns[13]','$columns[14]','$columns[15]', '$columns[16]','$columns[17]','$columns[18]','$columns[19]', '$columns[20]']) } ] ) ); -- Scott Taylor Systems Administrator DCT Chambers Trucking Ltd. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Elusive Syntax
I've not had luck calling a while loop (or any loop, for that matter) during the creation of a table - I did something like this - hope this helps. my $table_data = ; while ( @columns = $cursor-fetchrow ) { $table_data .= td([ '$columns[0]', '$columns[1]', '$columns[2]', '$columns[3]', '$columns[4]', '$columns[5]', '$columns[6]', '$columns[7]', '$columns[8]', '$columns[9]', '$columns[10]','$columns[11]', '$columns[12]','$columns[13]','$columns[14]','$columns[15]', '$columns[16]','$columns[17]','$columns[18]','$columns[19]', '$columns[20]']); } print table({-border=undef}, caption('Contacts'), Tr({-align=CENTER,-valign=TOP}, [ th(['First Name','Last Name','Title','Company','Work Ph.','Home Ph.', 'Fax Number','Other Ph.','Email Addr.','City','Prov.','Postal', 'Country','Custom 1','Custom 2','Custom 3','Custome 4','Notes', 'Category']), $table_data, ] ) ); Brian Arnold [EMAIL PROTECTED] -Original Message- From: Scott Taylor [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 12:52 PM To: [EMAIL PROTECTED] Subject: Elusive Syntax Anyone know how I can do this? I can't seem to get past a syntax error near the 'while'. (it worked up to the point I tried to put it into a table, and the table works fine by itself) use CGI qw/:standard *table start_ul/; require DBI; require HTTP::Date; . print table({-border=undef}, caption('Contacts'), Tr({-align=CENTER,-valign=TOP}, [ th(['First Name','Last Name','Title','Company','Work Ph.','Home Ph.', 'Fax Number','Other Ph.','Email Addr.','City','Prov.','Postal', 'Country','Custom 1','Custom 2','Custom 3','Custome 4','Notes', 'Category']), while ( @columns = $cursor-fetchrow ) { td([ '$columns[0]', '$columns[1]', '$columns[2]', '$columns[3]', '$columns[4]', '$columns[5]', '$columns[6]', '$columns[7]', '$columns[8]', '$columns[9]', '$columns[10]','$columns[11]', '$columns[12]','$columns[13]','$columns[14]','$columns[15]', '$columns[16]','$columns[17]','$columns[18]','$columns[19]', '$columns[20]']) } ] ) ); -- Scott Taylor Systems Administrator DCT Chambers Trucking Ltd. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weekly list FAQ posting
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): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] This is a high traffic list (100+ messages per day), so please subscribe in the way which is best for you. 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a week, and will be available online in the archives, and at http://learn.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who owns this list? Who do I complain to? Casey West owns the beginners list. You can contact him at [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl beginners. 1.11 - When was this FAQ last updated? Sept 07, 2001 2 - Questions about the 'beginners' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Monkeys * Monkeys solicitating homework on non-Perl related SPAM. 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl, then it is allowed. You can ask CGI, networking, syntax, style, etc... types of questions. If your question has nothing at all to do with Perl, it will likely be ignored. If it has anything to do with Perl, it will likely be answered. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) Please do not quote the documentation unless you have something to add to it. It is better to direct someone to the documentation so they hopefully will read documentation above and beyond that which answers their question. It also helps teach them how to use the documentation. 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: `perldoc perldoc' At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 2.8 Is this a high traffic list? YES! You have been warned! If you don't want to get ~100 emails per day from this list,
Re: symbolic reference of hashes in subroutines
RaFaL has answered the question you asked, but it should be mentioned that you are not using symbolic references in your code. \%hash is a hard reference. On Thu, Oct 18, 2001 at 09:33:06AM -0400, Ross Howard wrote: populate_hash (\%hash1, HEY1, value1); populate_hash (\%hash2, HUMM, HAH); [snip] sub populate_hash ($$\%) { my $hash = $_[0]; my $key = $_[1]; my $value = $_[2]; ${%{$hash}}{$key} = $value; } The prototype ($$\%) dictates the subroutine gets three arguments: a scalar, a scalar, and a hash that is enreferenced. Your example calls, however, are: hash reference (which is a scalar), scalar, scalar. The only thing preventing this from becoming a fatal error is that your prototype is declared too late, which perl warns you about if you have warnings turned on. Perhaps you meant: sub populate_hash (\%$$); populate_hash(%hash1, HEY1, value1); populate_hash(%hash2, HUMM, HAH); sub populate_hash (\%$$) { ... } Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Elusive Syntax
On Oct 18, Brian Arnold said: $table_data .= td([ '$columns[0]', '$columns[1]', '$columns[2]', '$columns[3]', '$columns[4]', '$columns[5]', '$columns[6]', '$columns[7]', '$columns[8]', '$columns[9]', '$columns[10]','$columns[11]', '$columns[12]','$columns[13]','$columns[14]','$columns[15]', '$columns[16]','$columns[17]','$columns[18]','$columns[19]', '$columns[20]']); Are you sure you want single quotes here?! I don't think you do. And you probably just want to use: $table_data .= td(@columns); It looks MUCH cleaner that way. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Select all files in a dir for processing?
Hello All, OK, I'm very new to Perl, so please don't flame me! I need to read in every file in a dir into a new file. I can do it like below if I know the file names, but how can I specify *.CSV? Actually there will be only the data files I need to read in the dir so *.* would work as well. Perhaps I should also mention this is running on Win 2K. Can I build an array (@Files)of file names and just call $Files[$i] instead of each file and increment i between files? If so, how would I build an array from a dir *.* command and how would I be sure not to include erroneous info returned? Is there a much better way to combine these files in order by name? Code I have now: #!/usr/bin/perl -w open(F1,C:/Temp/0912.CSV) || die Couldn't open F1.\n; #Open File 1 open(F2,C:/Temp/0913.CSV) || die Couldn't open F2.\n; #Open File 2 open(F3,C:/Temp/0914.CSV) || die Couldn't open F3.\n; #Open File 3 open(F4,C:/Temp/0916.CSV) || die Couldn't open F4.\n; #Open File 4 # Yada yada ya... open(STAT,C:/Temp/Stats.CSV) || die Couldn't open STAT.\n; #Create Stats file while(F1) { print STAT; #Print F1 - Stats } while(F2) { print STAT; #Print F2 - Stats } while(F3) { print STAT; #Print F3 - Stats } while(F4) { print STAT; #Print F4 - Stats } # Yada yada ya... I would also like to strip the first row from every file EXCEPT the first, or possibly from all and insert header row into Row 1 of resulting stats.csv file. Any suggestions on that? Thanks for any insight! Bill A. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
return a hash key
Let say I have a multikey hash: $poeple{$first}{$Last}{$MI}{$CITY} If I am passing values to this hash Is there a function or a way to retrieve missing keys from it? I know that if (! exists %poeple -{$first}-{$Last}-{$MI}) will return false or true. I want thes non valid keys temselves to be returned. Regards Al _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Greetings
Does any one have any good resources for processing SQL w/ Perl? Just basic stuff, ie: select * from table_name; type of statements?? Thanks Ya, Brian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
2 questions on perl.
Hi, I'm very new to perl. Have following two questions: Q1: Do we have a standard way to generate random numbers in perl ? Q2: How do we run system commands from a perl program ? Thanks and regards, Amit. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Elusive Syntax
On Thu, 18 Oct 2001, Scott Taylor wrote: Anyone know how I can do this? I can't seem to get past a syntax error near the 'while'. (it worked up to the point I tried to put it into a table, and the table works fine by itself) You have your while loop embedded in a print statement. Can't do that. You'll need to move it out and generate your columns before hand. -- Brett http://www.chapelperilous.net/ And now for something completely the same. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Greetings
On Thu, 18 Oct 2001, Brian wrote: Does any one have any good resources for processing SQL w/ Perl? Just basic stuff, ie: select * from table_name; type of statements?? Check out the DBI module: http://dbi.symbolstone.org That'll get you started. -- Brett http://www.chapelperilous.net/ Virtue is its own punishment. -- Denniston Righteous people terrify me ... virtue is its own punishment. -- Aneurin Bevan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 questions on perl.
On Thu, 18 Oct 2001, Amit Joshi wrote: Q1: Do we have a standard way to generate random numbers in perl ? perldoc -f rand perldoc -q random Q2: How do we run system commands from a perl program ? perldoc -f system perldoc -q system (perldoc -f gives you information on the usage of a specific function; perldoc -q gives you information from the FAQs) -- Brett http://www.chapelperilous.net/ You can't survive by sucking the juice from a wet mitten. -- Charles Schulz, Things I've Had to Learn Over and Over and Over -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Select all files in a dir for processing?
On Oct 18, Bill Akins said: I need to read in every file in a dir into a new file. I can do it like below if I know the file names, but how can I specify *.CSV? Actually there will be only the data files I need to read in the dir so *.* would work as well. Perhaps I should also mention this is running on Win 2K. To get the entries from a directory, you can use the opendir(), readdir(), and closedir() functions: opendir DIR, c:/files or die can't read c:/files: $!; @entries = readdir DIR; closedir DIR; That will put all the entries (files AND directories and other things) in the array. Note that it only puts the NAME of the entry (not the path), so you'll have foo and bar, not c:/files/foo and c:/files/bar. If you want those, you can add them like so: @entries = map c:/files/$_, readdir DIR; You'll probably want to skip all the directories (like . and ..), so you can add a grep() statement to filter them out: @entries = grep !-d, map c:/files/$_, readdir DIR; The -d file-test checks a variable (in this case, $_) to see if it is a directory, and we use ! to take the opposite. This means, in english: get the entries from the directory... prepend the path to each of them... accept only non-directories... and store them in @entries Notice how it reads backwards. If you want, there's a shorter mechanism that may provide what you need. While you can use a regex to make sure the filename ends in .CSV: @entries = grep !-d /\.CSV\z/, map c:/files/$_, readdir DIR; you might find it easier just to use the glob() function: @entries = grep !-d, glob(c:/files/*.CSV); That ONE line takes the place of the opendir(), readdir(), and closedir() lines. It also takes care of prepending the path name to the files (so no map() is required). The grep() is still there because I'm paranoid, and you might have a directory named foo.CSV. (I know you probably don't, but like I said, I'm paranoid.) To read more about these functions, check the 'perlfunc' documentation: perldoc perlfunc perldoc -f opendir perldoc -f readdir perldoc -f closedir perldoc -f glob or go online to http://www.perl.com, http://www.perldoc.org/, or http://www.perldoc.com/. Now, for your file concatenation... open(F1,C:/Temp/0912.CSV) || die Couldn't open F1.\n; #Open File 1 I'm glad you have error checking, but it's a good idea to include the $! variable in the die() message -- it explains what went wrong. See my opendir() example above. open(F2,C:/Temp/0913.CSV) || die Couldn't open F2.\n; #Open File 2 open(F3,C:/Temp/0914.CSV) || die Couldn't open F3.\n; #Open File 3 open(F4,C:/Temp/0916.CSV) || die Couldn't open F4.\n; #Open File 4 # Yada yada ya... open(STAT,C:/Temp/Stats.CSV) || die Couldn't open STAT.\n; #Create Stats file while(F1) { print STAT; #Print F1 - Stats } [snip] Now you get to learn about some of the magic that Perl has to offer! It combines the @ARGV array with the use of an empty operator. When you use , and @ARGV has values in it, Perl uses those values as names of files to read from, one by one. So let's prepare for the magic. @ARGV = grep !-d, glob c:/files/*.CSV; Now we can read from them and print each file in sequence to some output file: open OUT, c:/files/all.txt or die can't create c:/files/all.txt: $!; while () { print OUT; } close OUT; That was wonderfully simple! I would also like to strip the first row from every file EXCEPT the first, or possibly from all and insert header row into Row 1 of resulting stats.csv file. Any suggestions on that? This requires some more effort, but can be explained without causing too bad a headache. ;) The eof() function tells us when we've reached the end of a file; there is a special use of it -- eof -- that checks the last file we have read from. In addition to this function, there is a builtin variable, $., which is the line number of the line from the most recently read-from filehandle. The problem with $. is it doesn't get reset if you open another file... with the same filehandle... without closing the first one: open FOO, file_with_2_lines; while (FOO) { print $.: $_ } open FOO, file_with_4_lines; while (FOO) { print $.: $_ } This will give output like: 1: A first line 2: A second line 3: B first line 4: B second line 5: B third line 6: B fourth line If we had a close(FOO) before the second open() call, the numbers would have started at 1 again for file_with_4_lines. WHAT DOES THIS MEAN FOR YOU? Well, the magical reads read from a filehandle called ARGV, but ARGV doesn't get closed between files. That means that doing while () { print $.: $_ } would start with 1: and keep going up -- it would never reset to 1: again, unless you manually closed the ARGV filehandle. But how can we close ARGV at the right time? That's right -- eof. while () { print $.: $_; close ARGV if eof; } Now the numbering looks right. Your problem is related to
Re: return a hash key
On Thu, Oct 18, 2001 at 05:50:33PM +, AL H wrote: Let say I have a multikey hash: $poeple{$first}{$Last}{$MI}{$CITY} If I am passing values to this hash Is there a function or a way to retrieve missing keys from it? I know that if (! exists %poeple -{$first}-{$Last}-{$MI}) will return false or true. I want thes non valid keys temselves to be returned. There is nothing builtin to do what you want. You'd have to test each key to see if it's there. Also, the syntax %people-{...}, while supported, should not be used. It should be $people-{...}. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Check for a process
How do I replicate ps -awxx (berkly ps command )command on windows NT. Basically I am trying to monitor cretain java processes on an NT/2000 machines with certain option(s)in the command line. I would like to know is there a module or a command that I can execute and as the result, I would like to get whole command line for a given process. If I were to tell the command, I am looking for java process, it should return all the java processes with their full command line. Amar Patel _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Passing parameters to perl from C++
I am not even sure if this is possible, though it seems like something Perl would be capable of. I have a C++ program with perl embedded in it. I want to pass two arrays to perl, one with keynames and the other with values in it. Once in the perl code, I want to make variables with name from the keyname array, and then assign values to them from the array of values. Just in case that wasn't clear, let's say I have in the C++ program an array with the elements i, j, and k in it, and an array with the elements 1, 2, and 3 in it. Once I am in the perl code, I want $i = 1, $j = 2, and $k = 3. Is this possible, and if so could someone give me a quick clip of code for it? Thank you much, Lotto. . -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: return a hash key
-Original Message- From: AL H [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 1:51 PM To: [EMAIL PROTECTED] Subject: return a hash key Let say I have a multikey hash: $poeple{$first}{$Last}{$MI}{$CITY} If I am passing values to this hash Is there a function or a way to retrieve missing keys from it? I know that if (! exists %poeple -{$first}-{$Last}-{$MI}) will return false or true. I want thes non valid keys temselves to be returned. Regards Actually, ! exists %poeple -{$first}-{$Last}-{$MI} is not valid syntax. I assume you meant !exists $poeple{$first}-{$Last}-{$MI} which can be shortened to !exists $poeple{$first}{$Last}{$MI} This expression will auto-vivify $people{$first} and $people{$first}{$Last} if they don't already exist (but NOT $poeple{$first}{$Last}{$MI}). Is this really your data model? Why all the nested levels of hashes? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie using Spreadsheet::ParseExcel
I had the -w option on (!/usr/bin/perl -w). When I took out the -w, the mystery message went away. I'm still a bit disturbed that I ever got it, but the program runs fine. Lotto. . P.S. Sorry about all of those reposts, it took forever for the posts to appear for me, and I thought I was doing something wrong during posting. Eric Lotto wrote: Forgive me if this post is a duplicate. I tried sending it through my newsgroup reader first, and it did not seem to get through. I wrote a program (on linux platform) to read in an Excel file, and write the data out to a fixed-length field file. I used the ParseExcel module, but it loads the entire Excel file into memory. This works great for test files, but the files it will actually be used for are much too large. So I am now rewriting the program to use the CellHandler with Parse. Unfortunately Parse skips cells which are null, which leaves fields out. This does not work for a fixed-length file. I think I found a way around it, and it is ugly. Furthermore, I get the message Use of uninitialized value at when I am looping through the missing fields. It is very odd behavior (or at least it seems so to me) because if I put the exact same line of code in another area, that line will not generate that message. Here is my subCellHandler: sub subCellHandler($) { my($ovBook, $ivSheet, $ivRow, $ivCol, $ovCell) = @_; if($ivSheet != $sheet){ return;} if(($skip != 0) ($ivRow == 0)){ #skip cells in first row (headers) $iRow = 1; return; } if($ivCol = $numCol){ return;} #cell outside of requested fields while(($iCol != $ivCol) || ($iRow != $ivRow)){ $iCol++; if($iCol $numCol){#new row print OUTFILE \n; $iRow++; $iCol = 0; } if(($iCol != $ivCol) || ($iRow != $ivRow)){ #if still unequal, have blank cell(s) print OUTFILE x ($colWidth[$iCol]); } } #end of while($iCol...) $printValue = $ovCell-Value; $lengthDif = $colWidth[$ivCol]; $lengthDif = $lengthDif - length($printValue); if($lengthDif 0){ $printValue = $printValue . x $lengthDif; } #pad field with spaces elsif($lengthDif 0){#cell value is too big to fit in fixed field $strChopped = ; for(my $i = 0; $i $lengthDif; $i--){ $strChopped = chop($printValue) . $strChopped; } print STDERR String \$strChopped\ removed from end of Row:, $ivRow+1, Column:, $ivCol+1, \n; } print OUTFILE $printValue or die Error printing cell: R:, $ivRow+1, C:, $ivCol+1,\nAborting conversion.\nErrored out ; } #End of subCellHandler() * The mystery message seems to come from the line with the if still unequal, have blank cell(s) comment. Thank you much, Lotto. . -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Passing parameters to perl from C++
If it would be easier, I would like to make the variables (made from keyname elements) into constants. Otherwise I could just set them to indexes for the value array. That way, instead of assigning the value array elements to the variables, I could just use the variables to reference the elements in the array. Eg. $value[$k] would be equal to 3. Lotto. . Lotto wrote: I am not even sure if this is possible, though it seems like something Perl would be capable of. I have a C++ program with perl embedded in it. I want to pass two arrays to perl, one with keynames and the other with values in it. Once in the perl code, I want to make variables with name from the keyname array, and then assign values to them from the array of values. Just in case that wasn't clear, let's say I have in the C++ program an array with the elements i, j, and k in it, and an array with the elements 1, 2, and 3 in it. Once I am in the perl code, I want $i = 1, $j = 2, and $k = 3. Is this possible, and if so could someone give me a quick clip of code for it? Thank you much, Lotto. . -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
array of arrays
Hi. Im using a multidimensional array in the following way: $array[$i][$j][$k] = [ @list ]; where, @list is a 2-D array ie. $list[][]. How do I access the individual elements of the array @list once Ive put it into the array @array? Thanks. -ty -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Fraction to integer.
Hi, Is there a way in perl to directly convert a fractional number to its nearest integer value ?? Thanks, Amit. _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Fraction to integer.
-Original Message- From: Amit Joshi [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 4:58 PM To: [EMAIL PROTECTED] Subject: Fraction to integer. Hi, Is there a way in perl to directly convert a fractional number to its nearest integer value ?? perldoc -q round -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Fraction to integer.
On Thu, Oct 18, 2001 at 08:57:40PM +, Amit Joshi wrote: Is there a way in perl to directly convert a fractional number to its nearest integer value ?? See perldoc -q round. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: array of arrays
On Thu, Oct 18, 2001 at 02:28:41PM -0600, Tyler Cruickshank wrote: $array[$i][$j][$k] = [ @list ]; where, @list is a 2-D array ie. $list[][]. How do I access the individual elements of the array @list once Ive put it into the array @array? $array[$i][$j][$k][$l][$m] eq $list[$l][$m] However, this is the first time I've seen someone intentionally using such a large-dimension array. What is this for? Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Fraction to integer.
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Amit Joshi) wrote: Is there a way in perl to directly convert a fractional number to its nearest integer value ?? use the int() function. http://www.perldoc.com/perl5.6.1/pod/func/int.html -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: array of arrays
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Michael Fowler) wrote: $array[$i][$j][$k][$l][$m] eq $list[$l][$m] However, this is the first time I've seen someone intentionally using such a large-dimension array. What is this for? i've used many more dimensions than that ;) -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Special characters from perl to MySQL
I'm trying to enter data into MySQL and can't seem to be able to enter the question mark and the quote characters. I've tried every way of quoting (and backslashing) I can think of to no avail. With the quote I get an error from MySQL saying the query was bad (i.e. the query ended at the quote) and with the question mark it gets entered as a funky block that, when read from mysql and printed by perl, is NULL. This is probably more of a MySQL question than perl but I haven't been able to find anything in any of the MySQL documentation about it so I'm not so sure. I've currently sidestepped the problem by using the HTML special character notation (the text is HTML content) but it's a duct-tape/coat-hanger solution that doesn't work for me in the long term. Any help is appreciated. _42 __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Special characters from perl to MySQL
On Oct 18, 2001 at 04:03 -0700, Matt Klicka took the soap box and proclaimed: : I'm trying to enter data into MySQL and can't seem to : be able to enter the question mark and the quote : characters. I've tried every way of quoting (and : backslashing) I can think of to no avail. With the : quote I get an error from MySQL saying the query was : bad (i.e. the query ended at the quote) and with the : question mark it gets entered as a funky block that, : when read from mysql and printed by perl, is NULL. : This is probably more of a MySQL question than perl : but I haven't been able to find anything in any of the : MySQL documentation about it so I'm not so sure. Are you using the $dbh-quote() method? This will quote data to the underlying databases requirements. my $data = $dbh-quote( $rawdata ); $sth-do( INSERT INTO foo VALUES $data ); Casey West -- Drill for oil? You mean drill into the ground to try and find oil? You're crazy. -- Drillers who Edwin L. Drake tried to enlist to his project to drill for oil in 1859. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
What is Auto-Vivification
Friends -- Could you briefly explain the term auto-vivification? I have seen this quite a few times in some of the responses. A simple example to prove the point would be greatly appreciated. Thanks, Rex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is Auto-Vivification
--- [EMAIL PROTECTED] wrote: Friends -- Could you briefly explain the term auto-vivification? I have seen this quite a few times in some of the responses. A simple example to prove the point would be greatly appreciated. Thanks, Rex Rex, Auto-vivification is trying to access a hash entry that doesn't exit. If that is done, the hash entry is typically created with an 'undef' value. my %hash = ( foo = 'bar', baz = 'qux' ); print $hash{ 'foo' }; # prints 'bar' print $hash{ 'stuff' }; # prints nothing, but now $hash{ 'stuff' } exists and is equal to undef To check for a hash entry without auto-vivifying it, use 'exists'. if ( exists $hash{ 'stuff } ) { print $hash{ 'stuff' }; } else { print q|No %hash entry for 'stuff'.|; } Cheers, Curtis Ovid Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) Ovid on http://www.perlmonks.org/ __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is Auto-Vivification
On Oct 18, Curtis Poe said: Friends -- Could you briefly explain the term auto-vivification? I have seen this quite a few times in some of the responses. Auto-vivification is trying to access a hash entry that doesn't exit. If that is done, the hash entry is typically created with an 'undef' value. Incorrect. my %hash = ( foo = 'bar', baz = 'qux' ); print $hash{ 'foo' }; # prints 'bar' print $hash{ 'stuff' }; # prints nothing, but now $hash{ 'stuff' } exists and is equal to undef No. Auto-vivification refers to the automatic generation of a reference where there was originally undef (or nothing). It is not related (or at least restricted) to hashes. Here is an example: %foo = ( this = [10,20,30], that = [40,50,60] ); print @{[ %foo ]}\n; # this ARRAY(...) that ARRAY(...) print $foo{this}[1]; # 20 print $foo{that}[2]; # 60 print $foo{those}[3]; # nothing print @{[ %foo ]}\n; # this ARRAY(...) that ARRAY(...) those ARRAY(...) Notice how using $foo{those} as a reference caused it to become an array reference (albeit an empty one)? -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file:
I don't get any output: I'm using at the 1st line within the script #!/usr/bin/perl -w Which has included the below script. To execute from command line I input This scripts name add 2 4 ret Still get a syntax error:( Juan Amore HPCS ENGINEERING 1-748-8789 -Original Message- From: Peter Scott [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 4:55 PM To: AMORE,JUAN (HP-Roseville,ex1); 'Gibbs Tanton - tgibbs'; AMORE,JUAN (HP-Roseville,ex1); 'Beginners@Perl. Org (E-mail)' Subject: RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file: At 04:28 PM 10/17/01 -0700, AMORE,JUAN (HP-Roseville,ex1) wrote: Hello Tanton or Perl Gurus, I attempt to run this file but I get a syntax error in the location of foreach (@list)..? What is your output from /usr/bin/perl -v ? I'll bet it says 5.004 or earlier. Can someone advise if I do have a syntax error, I tried many ways of adjusting that area but no luck:( Please Help!! #!/usr/bin/perl -w my $function = shift @ARGV; if( $function =~ /add/ ) { $rtn = add( @ARGV ); print The sum is :$rtn; } elsif( $function =~ /multiply/ ) { $rtn = multiply( @ARGV ); print The product is :$rtn; } sub add { my @list = @_; my $sum = 0; $sum += $_ foreach (@list); sub multiply { my @list = @_; my $prod = 1; $prod *= $_ foreach (@list); } file 35 lines, 795 characters prompt file add 2 2 ret # this is the command line. syntax error at file line 27, near $_ foreach syntax error at file line 33, near $_ foreach Execution of file aborted due to compilation errors. Juan Amore HPCS ENGINEERING 1-748-8789 -Original Message- From: Gibbs Tanton - tgibbs [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 1:38 PM To: 'AMORE,JUAN (HP-Roseville,ex1)'; Beginners@Perl. Org (E-mail) Subject: RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file: You probably want to do something like: my $function = shift @ARGV; # function is now add or whatever and @ARGV has one less # argument in it (e.g. $ARGV[0] == 1 $ARGV[1] == 2) if( $function =~ /add/ ) { $rtn = add( @ARGV ); # pass the remaining arguments to the function } elsif( $function =~ /multiply/ ) { $rtn = multiply( @ARGV ); } sub add { my @list = @_; # make list be the arguments passed in to add my $sum = 0; $sum += $_ foreach( @list ); # loop through each element and add it to sum } sub multiply { my @list = @_; my $prod = 1; $prod *= $_ foreach( @list ); } Hope this helps. Tanton -Original Message- From: AMORE,JUAN (HP-Roseville,ex1) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 3:31 PM To: Beginners@Perl. Org (E-mail) Cc: AMORE,JUAN (HP-Roseville,ex1) Subject: FW: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file: Hello Perl gurus; Can anyone help me show what to add in the sub routine area using a length array $len=@ARGV so that I can add or multiply numbers. Command line is This file add 1 2 ret I trying to use if ($ARGV[0]=~/add/){ $rtn=add(...); print The sum is:$rtn; } elsif ($ARGV[0]=~/multiply/){ $rtn=multiply(...); print The product is:$rtn; } sub add { } sub mulitply { } Thanks:) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Special characters from perl to MySQL
On Thu, 18 Oct 2001, Matt Klicka wrote: I'm trying to enter data into MySQL and can't seem to be able to enter the question mark and the quote characters. I've tried every way of quoting (and backslashing) I can think of to no avail. With the quote I get an error from MySQL saying the query was bad (i.e. the query ended at the quote) and with the question mark it gets entered as a funky block that, when read from mysql and printed by perl, is NULL. This is probably more of a MySQL question than perl but I haven't been able to find anything in any of the MySQL documentation about it so I'm not so sure. You need to escape the characters in question with a \ INSERT INTO names VALUES ('O\'Connor', 'question\?'); This is pretty standard with all SQL servers. I think you can also escape the ' with a ': O''Connor -- Brett http://www.chapelperilous.net/ Like punning, programming is a play on words. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What is Auto-Vivification
Thanks Curtis. However, I am not seeing what you had mentioned in your response. When I tested this code, it did not create a key called 'key3'. #!/usr/bin/perl # Test Auto-vivification use strict; my(%hash); %hash = ( 'key1'='val1', 'key2'='val2'); #Please note that I am trying to access a new non-existing key called 'key3' print (\n $hash{'key1'}\n\n $hash{'key2'}\n\n $hash{'key3'}); while(my($key,$val) = each %hash){ print ($key == $val\n\n); } -Original Message- From: Curtis Poe [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 7:23 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: What is Auto-Vivification --- [EMAIL PROTECTED] wrote: Friends -- Could you briefly explain the term auto-vivification? I have seen this quite a few times in some of the responses. A simple example to prove the point would be greatly appreciated. Thanks, Rex Rex, Auto-vivification is trying to access a hash entry that doesn't exit. If that is done, the hash entry is typically created with an 'undef' value. my %hash = ( foo = 'bar', baz = 'qux' ); print $hash{ 'foo' }; # prints 'bar' print $hash{ 'stuff' }; # prints nothing, but now $hash{ 'stuff' } exists and is equal to undef To check for a hash entry without auto-vivifying it, use 'exists'. if ( exists $hash{ 'stuff } ) { print $hash{ 'stuff' }; } else { print q|No %hash entry for 'stuff'.|; } Cheers, Curtis Ovid Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) Ovid on http://www.perlmonks.org/ __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is Auto-Vivification
On top of what Jeff said, here is an article on autoviv: http://tlc.perlarchive.com/articles/perl/ug0002.shtml Cheers, Kevin On Thu, Oct 18, 2001 at 07:10:45PM -0400, [EMAIL PROTECTED] ([EMAIL PROTECTED]) said something similar to: Friends -- Could you briefly explain the term auto-vivification? I have seen this quite a few times in some of the responses. -- [Writing CGI Applications with Perl - http://perlcgi-book.com] I find this a nice feature but it is not according to the documentation. Or is it a BUG?Let's call it an accidental feature. :-) -- Larry Wall in [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Fraction to integer. novice 2 cents
Joel R Stout wrote: printrand: $p \n; print int: $q \n; printceil: $r \n; print floor: $s \n; if ( $p - $s = .5 ){ $t = $r } else { $t = $s } print rounded: $t\n; Another novice's 2 [euro] cents: $round = ($number0)?floor($number+.5):ceil($number-.5); Results of this are: $number -5.6 -5.5 -5.4 -5.0 +0.0 +0.4 +0.6 +1.0 +1.1 +1.5 +1.7 $round -6.0 -6.0 -5.0 -5.0 -0.0 +0.0 +1.0 +1.0 +1.0 +2.0 +2.0 Regards, -- Juanra || http://html.conclase.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file:
At 07:33 PM 10/18/01 -0400, AMORE,JUAN (HP-Roseville,ex1) wrote: I don't get any output: I'm using at the 1st line within the script #!/usr/bin/perl -w Which has included the below script. To execute from command line I input This scripts name add 2 4 ret Still get a syntax error:( Juan Amore HPCS ENGINEERING 1-748-8789 Sorry, the syntax error was due to a missing } as someone else pointed out. But if you type /usr/bin/perl -v at a shell prompt you will get output that you will find useful to know in the future. -Original Message- From: Peter Scott [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 4:55 PM To: AMORE,JUAN (HP-Roseville,ex1); 'Gibbs Tanton - tgibbs'; AMORE,JUAN (HP-Roseville,ex1); 'Beginners@Perl. Org (E-mail)' Subject: RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file: At 04:28 PM 10/17/01 -0700, AMORE,JUAN (HP-Roseville,ex1) wrote: Hello Tanton or Perl Gurus, I attempt to run this file but I get a syntax error in the location of foreach (@list)..? What is your output from /usr/bin/perl -v ? I'll bet it says 5.004 or earlier. Can someone advise if I do have a syntax error, I tried many ways of adjusting that area but no luck:( Please Help!! #!/usr/bin/perl -w my $function = shift @ARGV; if( $function =~ /add/ ) { $rtn = add( @ARGV ); print The sum is :$rtn; } elsif( $function =~ /multiply/ ) { $rtn = multiply( @ARGV ); print The product is :$rtn; } sub add { my @list = @_; my $sum = 0; $sum += $_ foreach (@list); sub multiply { my @list = @_; my $prod = 1; $prod *= $_ foreach (@list); } file 35 lines, 795 characters prompt file add 2 2 ret # this is the command line. syntax error at file line 27, near $_ foreach syntax error at file line 33, near $_ foreach Execution of file aborted due to compilation errors. Juan Amore HPCS ENGINEERING 1-748-8789 -Original Message- From: Gibbs Tanton - tgibbs [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 1:38 PM To: 'AMORE,JUAN (HP-Roseville,ex1)'; Beginners@Perl. Org (E-mail) Subject: RE: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file: You probably want to do something like: my $function = shift @ARGV; # function is now add or whatever and @ARGV has one less # argument in it (e.g. $ARGV[0] == 1 $ARGV[1] == 2) if( $function =~ /add/ ) { $rtn = add( @ARGV ); # pass the remaining arguments to the function } elsif( $function =~ /multiply/ ) { $rtn = multiply( @ARGV ); } sub add { my @list = @_; # make list be the arguments passed in to add my $sum = 0; $sum += $_ foreach( @list ); # loop through each element and add it to sum } sub multiply { my @list = @_; my $prod = 1; $prod *= $_ foreach( @list ); } Hope this helps. Tanton -Original Message- From: AMORE,JUAN (HP-Roseville,ex1) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 3:31 PM To: Beginners@Perl. Org (E-mail) Cc: AMORE,JUAN (HP-Roseville,ex1) Subject: FW: Anyone know to how use subroutines to add or multiply numbers :How would I modify my file: Hello Perl gurus; Can anyone help me show what to add in the sub routine area using a length array $len=@ARGV so that I can add or multiply numbers. Command line is This file add 1 2 ret I trying to use if ($ARGV[0]=~/add/){ $rtn=add(...); print The sum is:$rtn; } elsif ($ARGV[0]=~/multiply/){ $rtn=multiply(...); print The product is:$rtn; } sub add { } sub mulitply { } Thanks:) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Listing directory contents
Mebbe something like this? sub ls { for ($_[0]/*) { print $_\n; ls($_) if -d; } } ls .; On Tue, 16 Oct 2001, The Black Man wrote: Date: Tue, 16 Oct 2001 08:10:31 -0700 (PDT) From: The Black Man [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Listing directory contents Hi all, Is there a command to recursively list the contents of a directory, and all subdirectories? Thanks, James = Still pond, frog jumps in. Splash! There he goes...one of God's own prototypes. A high-powered mutant of some sort, never meant for mass production... Too weird to live, and too rare to die... AIM: TaoJonesin __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
output from system call
Hi, I've got a perl script that is front-ending a group of makefiles. The makefiles have 'echo' progress msgs in them. Now if I run the makes from the cmd line I (obviously) get the progress msgs on the terminal. I'd like to know how I can coerce perl into the same behaviour. I know I can get the msgs in a result variable but I'd like them to appear at the time they're issued. Thanks for any help you can give me on this. Gregory Nicholls, -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perl Project - Suggestions
Hi there... Please cc reply to my email address. :) I have the following project to complete ASAP and am looking for guideance. I am a complete Perl novice but understand little tidbits about Perl... Any pieces of information would be most helpful or some software that helps get things rolling..:) I have a flat file database (perhaps will import to MySQL in future) which contains a list of phone numbers and a few other small fields. The database needs to be queried via a web page. It's a DSL phone number database and will tell web visitors whether or not a company can provide DSL service to them or not. So the software runs the phone number and then depending on the results returns one of four possibilities: Phone number is residential and can get DSL service Phone number is business and can get DSL service Phone number *may* be in an area that can get DSL service Phone number cannot get DSL service Any ideas on how to get started? Thanks in advance, Paul -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Moving Net::Ftp to another server
Greetings I have just installed gnu-make on a test AIX server in order to install and test Net::Ftp. This module installed fine and my program works using it. Now its time to move my program over to the production server. How can I take Net::Ftp along without reinstalling make and Net::Ftp again? thanks...randy epperson Lands' End Unix sysadmin / VM support [EMAIL PROTECTED] Don't anthropomorphize computers. They hate that. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What is Auto-Vivification
--- Jeff 'japhy' Pinyan [EMAIL PROTECTED] wrote: On Oct 18, Curtis Poe said: Friends -- Could you briefly explain the term auto-vivification? I have seen this quite a few times in some of the responses. Auto-vivification is trying to access a hash entry that doesn't exit. If that is done, the hash entry is typically created with an 'undef' value. Incorrect. [snip] Oops! :) Blew that one. Actually, the first part of my answer might have been *almost* correct if I hadn't restricted it to hashes and if I didn't, for some boneheaded reason, describe it as trying to 'access' something. Clearly, I am smoking crack. I'll just put the pipe down and step away from the keyboard now :) Cheers, Curtis Ovid Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) Ovid on http://www.perlmonks.org/ __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]