RE: Any Good SCM tool to manage Perl Code locally
You might want to have a look at Seapine Surround. It's not opensource, but you can get a free single-user license and it's a very good SCM program. It's also available on a variety of platforms. http://www.seapine.com/scmlicensing.html -Dan -Original Message- From: Parag Kalra [mailto:paragka...@gmail.com] Sent: Sunday, March 14, 2010 12:13 AM To: Perl Beginners Subject: Any Good SCM tool to manage Perl Code locally Hi All, Although it is not related to Perl directly and might be little strange question but still thought of consulting Perl gurus. Here is the thing - I mainly code in Perl and Bash and I don't use any SCM tool. And the reason I don't use it is because even if I configure a SCM server - I should be able to access it both from home and work place (which is unlikely to happen) So wanted to know if it is a possible to use any free opensource tool to manage code (only locally) where actual and current code resides in different local directory and I can checkout code locally in some other directory (in my working directory) Cheers, Parag -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Out of Memory error with large Oracle DB extraction
I'm working on a project that requires some rather large extractions from an Oracle DB (about 2 million rows) and while monitoring the task manager, I get an Out of memory error at about 2GB of mem usage. Client System Specifics: Win 2K3 Server 32-Bit SP2 Intel Xeon 2.5Ghz 8 CPU w/4GB RAM Activestate Perl 5.10.1 DBD-Oracle v1.21 DBI v1.607 Oracle 8i Database running on a SPARC/Solaris platform (using Oracle Client 10.2 on the windows box) I've never tried handling any extractions this big before, so have several questions: Is their a 2GB address barrier in Perl? Being a Windows Server version (which I'm not familiar with), Are there some windows user/process settings that might be limiting the max usable RAM? Is there a built-in way to transparently disk buffer the returned records? (I.E. not having to handle the buffering details myself and still be able to use $sth-fetchall_arrayref() ) Any other elegant methods or suggestions for handling data extractions of this size? Once again, this is new territory for me... any suggestions or examples greatly appreciated! Thanks! -Dan --- There are only 10 kinds of people in the world... Those that understand binary and those that don't!
Simple regex question
Simple question for the regEXperts out there... I have a string that is always in the format: a.nn+x.y a is always 5 chars n can be 1 or 2 digits x can be +/- (with sign), 1-4 digits y is always positive (no sign), 1-4 digits Some examples: A123C.11+002.001 FC32G.2-1.0 12B15.01+2145.15 I need all 4 pieces and the length of x y. The following works: my $id= A123C.11+002.001; my @tmp = split(/[\.+-]/,$id); my $part = $tmp[0]; my $unit = $tmp[1]; my $x = $tmp[2]; my $y = $tmp[3]; my $xlen = length $tmp[2]; my $ylen = length $tmp[3]; but in my quest for understanding regex, I'm always looking for more elegant (obfuscated :-) code... Anybody have a good one-liner for this? my ($part,$unit,$x,$y,$xlen,$ylen) = /* Some obfuscated code here.. */ Thanks! -Dan --- d...@mapson.ninemoons.com (To reply via email, remove 'reverse(nospam)' in address. Spambots are getting wy too smart nowadays...:-) -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: Simple regex question
Simple question for the regEXperts out there... I have a string that is always in the format: a.nn+x.y a is always 5 chars n can be 1 or 2 digits x can be +/- (with sign), 1-4 digits y is always positive (no sign), 1-4 digits snip What do you mean by chars? Is any character valid or are only printable characters valid, or only printable ASCII characters, or a-z, A-Z, and 0-9? (snip) Agreed, should have been clearer on this... a is alphanum, a-z,A-Z,0-9 Thanks Chas -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Log::Dispatch and Data::Dumper
I use Log::Dispatch frequently to set up both file and email logging. In the past I have also used it with Data::Dumper for logging in debug mode doing something like: $dispatcher-log(level = 'debug', message =sprintf(%s,Data::Dumper(\$somevar))); This makes logging hashes, arrays, objects, etc. very easy with no fuss, but it occurs to me that this is probably terribly inefficient since the entire contents of the variable being dumped are shoved into a string first, (effectively doubling the memory usage). I'm currently working on a project that can pull back a fairly large table from a database and would like to do something similar (at the debug log level only) and was just wondering if there were a more efficient way to pass the output of Data::Dumper to Log::Dispatch. -Dan
Parsing Key/Value pairs
I've got a data file with a bunch of key/value pairs in the format key=value;. There may be only one to a line, or there may be several. I know I can figure out how to do this using split, but I thought surely there must be a more elegant solution. I was trying to do this using the following, but I must be misunderstanding how the g modifier works. use strict; my $str1 = foo=bar;; my $str2 = okey=dokey;file=a file name with spaces;yourkey=mykey;; parsekeys($str1); parsekeys($str2); sub parsekeys { my ($str) = @_; while ($str =~ m/(.*)=(.*);/g){ print($1,$2\n); } } This prints: foo,bar okey=dokey;file=a file name with spaces;yourkey,mykey when what I'm really looking for is: foo,bar okey,dokey file,a file name with spaces yourkey,mykey Any help appreciated! Thanks, -Dan
RE: How to ftp all the files?
Might want to check out ncftp client. Works very well, multiple platform support and free! I use it for nearly all my batch ftp needs (albeit I have only used the Solaris version...) http://www.ncftp.com/ncftp/ -Dan -Original Message- From: Siegfried Heintze (Aditi) [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2008 12:50 PM To: beginners@perl.org Subject: How to ftp all the files? I'm using perl 5.8.8 on cygwin/windows 2003 server. This worked (but it was so tedious!): $ perl -MNet::FTP -e '$ftp =Net::FTP-new(mediaftp.wiley.com, Debug=0) or die cannot connect; $ftp-login(download,download) or die cannot login; $ftp-cwd(/product_ancillary/76/04701913/DOWNLOAD/) or die cannot cd; for (3..5) { print getting $_\n ; $ftp-get(ch. sprintf(%-2.2d,$_). CodeSample.zip) or die cannot get ; } '; Questions: 1. Is there an easier way? 2. More specifically: Are there some perl modules that will parse the string ftp://download:[EMAIL PROTECTED]/product_ancillary/76/04701913/D OWNLOAD/Ch05%20CodeSample.zip and download the file with one or two function calls instead of what I did above? 3. I tried calling mget but there was no such function. How could I wild card and get all the zip files in that directory? I was looking at http://search.cpan.org/~jdlee/Net-FTP-Recursive-2.02/Recursive.pm and wondering if this would solve my problem. Can someone help me modify my fragment above so it recursively fetches the entire directory? I was not sure how to pass that function pointer in the example in the documentation. 4. Is perl the best way to do this? Would it be easier in some other language/library like bash or python or ruby? Thanks! Siegfried -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: learning WWW::Mechanize
Assuming what you are really looking for from this is the page returned by the search, then you need to move the line: print $mechObject - content; to the end. -Dan --- #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $queryString = 'HelloWorld'; my $url = 'http://www.google.com/'; my $mechObject = WWW::Mechanize-new( autocheck = 1 ); $mechObject - get($url); $mechObject-form_number(1); $mechObject-field(q, $queryString); $mechObject-click(btnG); print $mechObject - content; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: Capturing stdout and stderr without redirection
Igor, thanks for the tip! A search of CPAN turned up IPC::Open3::Simple Very cool... Very easy to use and exactly what I needed. Separate callback subs for STDOUT and STDERR... just push anything fed to them into an array... When all done, if array size 0, fire off an email with the contents. Bingo! Works perfectly! Thanks again -Dan -Original Message- From: Igor Sutton [mailto:[EMAIL PROTECTED] Sent: Thursday, January 18, 2007 2:31 AM To: Dan Fish Cc: beginners@perl.org Subject: Re: Capturing stdout and stderr without redirection Hi Dan, 2007/1/18, Dan Fish [EMAIL PROTECTED]: I've got a perl wrapper that conditionally runs another perl program using system() Something like: If( some_condition_applies){ system(myperlscript.pl); } myperlscript.pl will complete silently if everything runs right, but because it reads some data files and interfaces to a mySQL database, there are times when it may encounter unforeseen errors. IF there is any output from myperlscript.pl, I'd like to capture it and send it off in an email. The sending in an email part I can handle. and I think I can probably redirect the output of myperlscript.pl to a file and read that, but is there a better, more elegant way to capture any stdout/stderr output WITHOUT having to redirect and read another file? Why don't you encapsulate the myperlscript.pl code on a reusable module, then just 'use' it? I'm supposing that both code was written by you. If you *really* needs that, you can use IPC::Open2 or IPC::Open3 (if you also needs STDERR). From IPC::Open3 documentation (perldoc IPC::Open3): my($wtr, $rdr, $err); $pid = open3($wtr, $rdr, $err, 'some cmd and args', 'optarg', ...); HTH! -- Igor Sutton Lopes [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Capturing stdout and stderr without redirection
I've got a perl wrapper that conditionally runs another perl program using system() Something like: If( some_condition_applies){ system(myperlscript.pl); } myperlscript.pl will complete silently if everything runs right, but because it reads some data files and interfaces to a mySQL database, there are times when it may encounter unforeseen errors. IF there is any output from myperlscript.pl, I'd like to capture it and send it off in an email. The sending in an email part I can handle. and I think I can probably redirect the output of myperlscript.pl to a file and read that, but is there a better, more elegant way to capture any stdout/stderr output WITHOUT having to redirect and read another file? Thanks! -Dan
How to push data onto a Class::Struct array?
I've got a Class::Struct array (@stack) that has, as one of it's members, another array of Class::Struct (@bop) I know how to make assignments explicitly, but can't figure out the syntax to use to push onto the (stack-bop) array. I need to do this mainly because I'll be pushing varying numbers of elements onto each (stack-bop) array in arbitrary sequence (not all nicely contained in a loop like the sample code below...) Explicit assignment gets messy as it requires keeping track of the next index value for each (bop) element in the (stack) array The following code is a greatly simplified version of what I'm trying to do, but I hope it conveys the idea.. Thanks, -Dan === code snippet === #!/usr/local/bin/perl -w use strict; use Class::Struct; use Data::Dumper; my @stack = (); struct( foo = { baz = '$', bop = '@', }); struct( bar = { p1 = '$', p2 = '$', }); #' Tick keeps emacs syntax colorizer happy... # the above decls seems to mess it up for (my $i=0; $i 3; $i++){ my $f = new foo; $f-baz($i); for (my $j=0; $j 3; $j++){ my $b = new bar; $b-p1($i); $b-p2($j); #How would I push $b onto bop here #rather than by direct assignment? $f-bop($j,$b); } push(@stack,$f); } print Dumper([EMAIL PROTECTED]); == end code snippet = -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Custom message formatting callback for Log::Dispatch
I want to set up Log::Dispatch with two outputs... file and email. I'd like to use a callback function to do custom formatting of the message based on whether the output is going to a logfile or email. I.E. a one line entry if sent to logfile and a verbose description, possibly including html, hyperlinks, etc if sent by email. I figured since the log method supports sending arbitrary named pairs to the callback function, all I needed to do was get the name of the Dispatch object doing the logging, and have the callback do the necessary formatting based on the destination, but getting the name of the Dispatch object is proving to be beyond my very measly perl programming skills! Any help would be greatly appreciated! Thanks, -Dan [EMAIL PROTECTED] (remove reverse(nospam) to reply via email.) Spambots are getting waaay too smart nowadays! == Sample code follows: == #!/usr/local/bin/perl -w use Log::Dispatch; use Log::Dispatch::Email::MailSend; use Log::Dispatch::File; use Data::Dumper; $sub = sub { my %p = @_; ## # if $p{type} == email do some formatting on $p{message}; # else do something else... or maybe nothing ;-P ## print Dumper(\%p); return $p{message}; }; $dispatcher = Log::Dispatch-new( callbacks = $sub); $dispatcher-add( Log::Dispatch::File-new( name = 'file1', min_level = 'debug', mode = 'append', filename = 'logfile' ) ); $dispatcher-add( Log::Dispatch::Email::MailSend-new( name = 'email', min_level = 'error', to = [ qw( [EMAIL PROTECTED] [EMAIL PROTECTED] ) ], subject = 'Oh no!!!') ); # # Need to get type to reflect dispatcher-outputs-name... # $dispatcher-log( level = 'error', message = ERROR level logging test\n, type=??? ); print Dumper(\$dispatcher); #EOF -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Looking for a mirror script (sorta)
I'm looking for a script that I can set up to periodically poll an ftp site, download all available files in a specified directory, and then delete the remote files. (Sorta like a mirror script with remote delete) AFAIK you can't delete remote files with mirror-2.9, which seemed to be the case with all the other mirror-type scripts that showed up during a web search. rsync won't work because I ONLY have ftp access... No rsh/ssh... (But I DO have read/write/delete ftp access) I'm sure I could hack something together using Net::FTP, but I thought I'd just check and see if anybody has a pointer to a battle-tested script before I re-invent the proverbial wheel... Thanks, -Dan --- Dan Fish - [EMAIL PROTECTED] (remove REVERSE(nospam) above to reply via email... The spambots are smart enough nowadays to remove a nospam for you...:-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Upgrading from Perl 5.6 to Perl 5.8
For now, just accept it as one of Perl's quirks. Kind of like Java 1.4.5 being Java Five, or whatever it is ... :-) Or maybe like Solaris 9 = Solaris 2.9 = SunOS 5.9 :-) Gotta hand it to them Sun folks... Always keeping us guessing -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Dynamic pattern matching?
I've got a data file that for the most part, the entries look like: (The last 3 columns are data points...) LKG_535 P10X0.6 -2.00E-09 0.00E+00 amps -3.800E-13 -3.920E-12 -7.800E-13 VT_GM L0.8H40 -1.15E+00 -7.50E-01 volts-1.104E+00 -1.111E+00 -1.110E+00 IDSAT_5 Y0.8N20 -5.80E-03 -3.00E-03 amps -5.036E-06 -5.001E-06 -4.853E-06 VT_GP P0.8X.6 -1.15E+00 -7.50E-01 volts-1.018E+00 -9.966E-01 -1.012E+00 LOGU_II2.00.6 6.00E-03 1.00E-02 amps 8.992E-03 8.939E-038.903E-03 which I match with the following: # RE for a valid floating point number $fp = qr/[+-]?\ *(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?/; # Case for 3 data points if $line =~ /(.{9})\s+(.{10})\s+.{4}\s+($fp)\s+($fp)\s+(.{8})\s+($fp)\s+($fp)\s+($fp)\s+ $/o) { $datapts = 3 #Insert matched vars into Class::Struct array... ... } But optionally, and once in a while there might be a line that looks like: (this case shows 3 extra columns [data points], but in reality there could be 1,3 or 5 more columns) HGYPG5M1_LG OT 0.00E+00 2.00E-08 amps 1.000E-06 4.000E-112.000E-116.000E-114.000E-118.000E-11 I know I can write an if() clause to match every possible case, but I'm wondering if there is a more general approach that would allow me to dynamically match a varying number of extra columns within a single expression. Thanks, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Pattern matching variables
Are ALL pattern matching variables set back to undef once another m// or s/// expression is encountered, even if it contains no parenthized expressions? For example, I would have expected $1 $2 to be valid in BOTH print statements below... #!/usr/bin/perl -w # $string=ABC DEF GHI JKL MNO PQR STU; if ($string =~ /(.{7})\s+(.{7})\s+/) { $p1 = $1; $p2 = $2; print (1 = $1, 2 = $2, p1 = $p1, p2 = $p2\n); $p1 =~ s/\s+//g; print (1 = $1, 2 = $2, p1 = $p1, p2 = $p2\n); } Thanks, -Dan --- Dan Fish - [EMAIL PROTECTED] A -good- dive buddy will be there if you run out of air, a -great- one will be there before you run out! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Determine the Binary format of a file
I have a binary file that I have been tasked to discover the format of and somehow convert the records to readable text. Is there any way I can find out what binary format the file is in, so I can create an template for unpack() to convert the binary to text? The best place to start is with the `file` command, and the magic numbers behind it, which not nearly enough people know about these days. On Unix systems (or Cygwin on Windows), `file` uses a database of magic numbers -- fingerprints for different file types -- to identify files, regardless of how the file is named (i.e. the file extension doesn't matter here). For example, consider this output: If you do manage to find out the file contains some sort of standard binary format per the 'file' command, you can also visit http://www.wotsit.org/ which contains very detailed information about the binary structure for hundreds of different known file formats. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Preventing shell redirection from creating empty file
I appologize that this is more of a shell question (tcsh) than a perl question, but I've found that most of the really good perl guru's are fairly decent shell wizards as well :-) I have a c-routine that calls a perl script something like this: system(myscript.pl arg1 arg2 myfile.txt); What is the easiest way to prevent myfile.txt from being created if the script dies or produces no output? (It seems the shell will always create myfile.txt, regardless) I can think of a couple of ways offhand... 1. Within the c-routine, check for an empty file after the script is run and remove if empty. 2. Handle the output directly from within the perl script with open/print/close (I.E. avoid redirection) I was hoping some shell guru out there knows a more generic approach. Thanks, -Dan --- Dan Fish - [EMAIL PROTECTED] A -good- dive buddy will be there if you run out of air, a -great- one will be there before you run out! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Piping output to and from external perl routine
original request snipped Copy and paste Tom's code into your program. Yes... I could do that, and HAVE actually done that before for other routines due to the fire-fighting time constraints of the moment :-) This time I was hoping to increase my *very-limited* knowledge of Perl for a more elegant solution, because I'm sure I'll need to do something similar again... Gunnar's response actually worked quite well... (Thanks Gunnar!) sub striphtml { local $_ = shift; do 'striphtml.pl'; $_ } $page = striphtml($page); -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Piping output to and from external perl routine
Is there an easy way to pipe output to an external perl routine and then pipe the output of that routine back in for more processing? In particular I want to use LWP::UserAgent to grab a web page, pipe the output to Tom Christiansen's striphtml routine (http://www.cpan.org/authors/Tom_Christiansen/scripts/striphtml.gz) and then pipe that output back in for some subsequent processing. Something like: my $ua = new LWP::UserAgent; my $request = new HTTP::Request('GET', $myURL); my $response = $ua-request($request); my $page = $response-content; open(STRIPHTML, |striphtml.pl) || die(Can\'t open striphtml: $!\n); print STRIPHTML $page; close(STRIPHTML); # maybe not such a good idea? This works fine so far... But now what? How do I get the output of striphtml.pl back in to do some more processing on it? I know I can do this with a temporary file, but I loathe using them when reasonable alternatives might be available... Thanks! -Dan --- Dan Fish - [EMAIL PROTECTED] A -good- dive buddy will be there if you run out of air, a -great- one will be there before you run out! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Passing a variable to a package function vs. a local function
I'm a bit new to this so please bear with me... I've written a script that uses CGI.pm something like this: use CGI::Carp qw(fatalsToBrowser); use CGI qw(:all); $query = new CGI; blah...blah... myfunc($query); blah...blah... sub myfunc{ my ($query) = @_; $foo=$query-param(foo); ...more...blah...blah... } Everything works fine as is, but I'm trying to take the function myfunc out and put it in a separate .pm file because I need to call it from several cgi scripts. When I put it in the .pm file, I get something like: Can't locate object method param via package Trend at /usr/local/lib/perl5/site_perl/5.005/MMC/Dex.pm line 253, INFILE chunk 1150. I do have: use CGI::Carp qw(fatalsToBrowser); use CGI qw(:all); In the .pm file What am I missing? Thanks, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Global variables
What would be the preferred method of creating global variables that can be used in several different cgi scripts. For example, I'd like to create the variables $database, $user, $pass that I only have to change in one place, but can use in many different scripts. In C of course I'd just use #INCLUDE, but I'm not very perliterate (yet)...:-) Thanks, -Dan --- Old programmers never die... Unless of course they refuse to accept a few extra CPU cycles over months of efficiency tuning... [Have times changed or WHAT!] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Setting environment variable for process spawned with system()
Yup... That worked just great! Thanks Jenda! -Dan -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 10:33 AM To: Perl List Subject: Re: Setting environment variable for process spawned with system() From: Dan Fish [EMAIL PROTECTED] Okay... maybe this is just so simple that I can't see the forest through the trees, but I've never had a need to do it before and so that inherently makes it difficult :-) I've got a script that runs gnuplot via system(). In order to use a custom path for gnuplot's fit regression function, It looks for the environment variable FIT_LOG. How can I set an environment variable in the script that will be inherited by the system() process? $ENV{FIT_LOG} = whatever; 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Setting environment variable for process spawned with system()
Okay... maybe this is just so simple that I can't see the forest through the trees, but I've never had a need to do it before and so that inherently makes it difficult :-) I've got a script that runs gnuplot via system(). In order to use a custom path for gnuplot's fit regression function, It looks for the environment variable FIT_LOG. How can I set an environment variable in the script that will be inherited by the system() process? Thanks, -Dan --- Old programmers never die... Unless of course they refuse to accept a few extra CPU cycles over months of efficiency tuning... [Have times changed or WHAT!] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Obtaining a slice of unique values from an array
What is the most efficient (or at least AN efficient :-) way of obtaining a slice from an array wherein the slice contains only unique values found in the array? I.E. if @array = (1,3,5,5,3,5,2,1) then @slice = (1,3,5,2) Thanks, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Use of uninitialized value
Correct if I'm wrong, but I think I understand the following warning means I'm trying to make use of an empty or undef variable, but if the problem isn't obvious, how do I find it? and what does the chunk # mean? Use of uninitialized value at MMC/Online_Entry.pm line 47, INFILE chunk 541. Thanks, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Advanced Users in The Beginners List
Perhaps we need a new module, PERLLIST::PARSE, that parses the incoming message and prefixes a category to the subject line so we can set up incoming mail filters to automatically dispose of 'dis'interesting messages I.E, (from some recent subject lines): FILE::changing the permission to owner VAR::Referring to a hash ref in the main script from a used module... REGEX::split with multiple pairs of parentheses DBG::while debugging - weird dereferencing problem DBI::Perl DBI and Oracle and of course when PERLLIST::PARSE itself gets confused then we have: BEGINNER::[subject] with a CC: to the perl developer's list :-) (Of course another alternative would be to have users post questions using 'valid perl syntax' ONLY :-) LOL... just my 2-cents worth as a 'beginner' (Since we are all beginners in one way or another as Ovid so eloquently pointed out...) -Dan -Original Message- From: George Thomas [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 29, 2002 8:09 AM To: [EMAIL PROTECTED] Subject: Re: Advanced Users in The Beginners List Good point, Ovid. Consider too that if one excludes the experienced programmer, many questions will go unanswered or may be answered incompletely or incorrectly. The coders with the experience have seen most of it and know quite a few tricks. They are an invaluable resource. I wouldn't want them to go away. Yasen, you might want to consider changing your subscription to the digest form if large quantities of messages are a problem. George Ovid wrote: --- Yasen Petrov [EMAIL PROTECTED] wrote: Hi there, I think there's too many andvanced users here who ask DBI questions. I can't understand anything. Perl.beginners and perl.beginners.cgi are both too overloaded. Noone can read 80 massages a day, in it? I mean perl.beginners. There should be perl.intermediate as well as perl.advanced. As for the DBI questions, they have to be set in the DBI list. Yasen, I've heard this before and I can assure you that many people sympathize with you. However, how do you define advanced? If someone is just learning object-oriented Perl, are they a beginner? I suppose that depends upon who is answering the question. Also, people who are comfortable with Perl yet have never used DBI will also see this as an appropriate resource. Yet people who barely know Perl and have to start using a database because their job requires it will definitely want to ask DBI questions here. I vie many of those questions as beginner. As to whether or not they should be relagated to the DBI lists, I'll leave that one to the list moderators :) As for myself, I simply delete most of the messages in this folder unless they have a subject line that catches my eye. I receive too much email to try and read them all; there's not much else that can be done. As a final note, I'll add my personal definition of Utopia: a place someone is guaranteed to hate. In short, concensus will not be had on this issue, so compromise is the way to go. Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- 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]
Script execution via email
I've got a perl script that reads a dozen or so various documents and data files and generates a custom report for me (Don't we all have a couple dozen of these? :-) All of that is working fine... What I'd *like* to do is be able to generate these reports on-demand from remote locations by setting up some sort of email trigger that will run the script when an email is sent to specially designated address and then return the results via email Has anybody attempted doing something like this?? I would guess I'd need to use Mail::POP3Client, and a cron script that runs periodically. Other ideas? Thought I'd just ask around, get some ideas, and see if maybe somebody knows of an existing script to start from before I set off to re-invent the proverbial wheel. Thanks, -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]