Re: How to can develop a program

2022-08-03 Thread Philip Parzygnat
For PDF related development one valuable resource is https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf I don’t have any experience in this but investigated many years ago to automate digital publication. Maybe it will help. I’m sure Perl can be applied but as

Re: about system() call

2018-07-24 Thread Darryl Philip Baker
For security I would add one additional caution. When executing a command wherever possible use the full pathname. To prevent running a malicious file hidden in your PATH. Example: “/bin/ls” and not “ls” Darryl Baker (he/him/his) Sr. System Administrator Distributed Application Platform Servic

Re: TLS and Perl

2018-01-25 Thread Darryl Philip Baker
, "SurfShop" wrote: > On Jan 25, 2018, at 10:43 AM, Darryl Philip Baker wrote: > > If you do not know TLS 1.0 and TLS 1.1 have a vulnerability in the design of the protocol and they are being deprecated. Currently only TLS 1.2 now and TLS 1.3 when finalized are consi

Re: TLS and Perl

2018-01-25 Thread Darryl Philip Baker
If you do not know TLS 1.0 and TLS 1.1 have a vulnerability in the design of the protocol and they are being deprecated. Currently only TLS 1.2 now and TLS 1.3 when finalized are considered safe. TLS 1.2 was defined in August of 2008 so if you are using anything developed in the last five years

Re: obstinate syntax errors

2018-01-19 Thread Darryl Philip Baker
I don't have the time to put everything around this to do the syntax test but what happens with this: If ( ! chdir "/big/dom/x$server/data/students/$progress_hash{student_id}/" ) { $message = "Can't change directory to $progress_hash{student_id}: $!"; report_e

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
I settled for an set of stacked if statements, saving the previous line if needed etc... Thanks for the help. Darryl Baker PMOET -DAPS X76674

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker wrote: While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert

A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert them to HTTPD 2.4 syntax in future production. I will need to

Re: REGEX Explanation

2011-04-08 Thread Philip Durbin
On 04/08/2011 03:12 AM, Anirban Adhikary wrote: Can anybody please explaing the meaning of the following regular expression my $x = '12abc34bf5'; @num = split /(a|b)+/, $x; YAPE::Regex::Explain is great for this: [pdurbin@beamish ~]$ perl -MYAPE::Regex::Explain -e 'print YAPE::Regex::Explai

Re: add newline

2010-08-04 Thread Philip Potter
On 4 August 2010 01:59, Rob Dixon wrote: > > Speed of execution is the last goal of all. > > First of all make your program functional and intelligible. > > Only after that, if you have problems with resources (including time, disk > space, or processor) tune it to be more efficient. This, a thou

Re: has and non unique keys

2010-08-02 Thread Philip Potter
On 2 August 2010 12:11, Sharan Basappa wrote: > I am not trying to be critical of perl or anything (if that is what you felt). I didn't think you were; it didn't come across as criticism. > I am only trying to see if a certain feature exists or not. > The current problem I am working on has dupl

sort hash in Data::Dumper

2010-06-20 Thread philge philip
hi can someone tell me how i can sort by keys from a hash (huge data) stored using Data::Dumper? thanking you philge

sorting DB_File hash data

2010-06-20 Thread philge philip
hi can someone tell me how i can sort by keys from a hash (huge data) stored in a DB_File? thanking you philge

store and edit perl hash data

2010-06-19 Thread philge philip
hi in the below script: use Storable qw(store_fd fd_retrieve); my %position_counts = ('name' => 'rahul'); open(OUT1, ">temp.txt"); store_fd(\%position_counts, *OUT1) || die "can't store to temp.txt\n"; close(OUT1); is it possible to change values of my hash "%position_counts" stored in the

Re: Use of uninitialized value in print at...

2010-06-06 Thread Philip Potter
On 6 June 2010 14:37, Shawn H Corey wrote: > On 10-06-06 09:06 AM, Chas. Owens wrote: >> >> But that is not the problem; autovivification will create the references: >> >> perl -MData::Dumper -le '$c->[0]{a}; print Dumper $c' >> > > But that is the problem.  Autovivification should not happen for

Re: Need simple perl script

2010-06-06 Thread Philip Potter
On 5 June 2010 17:47, Mephistopheles wrote: > 1. Run sdiff on file1 and file2--supress identical lines > 2. OUtput column1 to outputfile1 and column2 to outputfile2 What have you tried so far? We can't correct your code if you don't give us any code to correct. -- To unsubscribe, e-mail: beginn

beginners@perl.org

2010-05-24 Thread Philip Potter
On 24 May 2010 11:49, Weizhong Dai wrote: > Hi guys, I met a problem. > When I tried this script below: > > // > sub print_instruction { >  my ($disk, $start, $end) = @_; >  print "Move disk #$disk from $start to $end.\n"; > } > >

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 15:43, Harry Putnam wrote: > Philip Potter writes: > >> You are quite correct - there is no practical difference in this situation. >> >> [nitpick: actually, if $/ has been set to something other than "\n", >> $chosen may have a trailin

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 14:47, Harry Putnam wrote: > Philip Potter writes: >> On 8 May 2010 13:35, Harry Putnam wrote: >>> I'm curious about one thing I see there: >>> >>>  `/\A\d+\z/ ' as opposed to `/^\d+$/' >>> >>> in this snippet

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 13:35, Harry Putnam wrote: > I'm curious about one thing I see there: > >  `/\A\d+\z/ ' as opposed to `/^\d+$/' > > in this snippet: > >        if ( $chosen =~ /\A\d+\z/ && $chosen >= 1 && $chosen <= @h ) { >            print "Taking some action on $h[$chosen - 1]\n"; >            la

Re: how to arrange a default action in a dispatch table

2010-05-08 Thread Philip Potter
On 8 May 2010 13:09, Harry Putnam wrote: > "Uri Guttman" writes: > >> yes, i disable syntax coloring since it makes it HARDER for me to >> see > > [...] > > I'm terrible about leaving out one of "" '' () {} [] etc.. I always enter them in pairs. eg I first type if (condition) {} then put the c

Re: about dispatch tables

2010-05-05 Thread Philip Potter
On 5 May 2010 17:29, Harry Putnam wrote: > Anyway, I understood he was saying NOT global. > > What I asked is why that would matter.  That is, the values or > elements in @_ arrive inside the `sub dispt {...}', so should be > available to anything inside `sub dispt {...}'  right? > > And `%hash =

Re: about dispatch tables

2010-05-05 Thread Philip Potter
On 5 May 2010 15:26, Thomas Bätzler wrote: > Harry Putnam asked: > [...] >> which is also inside sub dispt {the sub function}.  Where does global >> come in? > > Hint: $code->(@_); Or indeed &$code; if you want to be cryptic :) Phil -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: about dispatch tables

2010-05-05 Thread Philip Potter
On 5 May 2010 14:36, Harry Putnam wrote: > "Uri Guttman" writes: > >>   HP> The output from the script below: >>   HP> Shows 6 elements arrive in dispt($g, @ar) as @_.  But when sub N(@_) >>   HP> is called, no variables arrive there. @_ is empty. When it seems like >>   HP> 5 elements should hav

Re: Still pondering working with hashs

2010-05-04 Thread Philip Potter
On 4 May 2010 15:19, Harry Putnam wrote: > Philip Potter writes: >> haven't explained *why* you are doing this comparison in this thread. >> [You might have done elsewhere, but I don't read every thread.] > Uri actually did (most of) it for me at one point in a

Re: Still pondering working with hashs

2010-05-04 Thread Philip Potter
On 4 May 2010 13:45, Bob McConnell wrote: > From: Uri Guttman > >>> "HP" == Harry Putnam writes: >> >>   HP> "Uri Guttman" writes: >>   >> nope. been doing this for 35 years and it is solid advice. you > can't do >>   >> a proper program unless you have a proper goal which is what the >>   >

Re: Still pondering working with hashs

2010-05-04 Thread Philip Potter
On 3 May 2010 22:06, Harry Putnam wrote: > Philip Potter writes: > > [...] > > Both you and Uri are right to a degree.  I have to respect Uris' > experience, but in fact I have presented goals at every step in this > thread.  Uri just doesn't want to recognize them

Re: Still pondering working with hashs

2010-05-03 Thread Philip Potter
On 3 May 2010 20:56, Uri Guttman wrote: >> "HP" == Harry Putnam writes: >  HP> "Uri Guttman" writes: >  >> this is what has been bothering me here. you haven't yet spit out a >  >> proper problem specification. as i kept saying comparing dir trees is >  >> tricky and you kept showing incompl

Re: testing if divisible by?

2010-05-03 Thread Philip Potter
2010/5/3 Jay Savage : > On Sat, May 1, 2010 at 7:45 AM, Philip Potter > wrote: >> On 1 May 2010 12:15, Paul wrote: >>> Hello all.  How can I test to see if a number is divisible by say, 40? >> >> Use the modulo operator %. Given integers $x and $y, the expr

Re: testing if divisible by?

2010-05-01 Thread Philip Potter
On 1 May 2010 12:15, Paul wrote: > Hello all.  How can I test to see if a number is divisible by say, 40? > Thanks. Use the modulo operator %. Given integers $x and $y, the expression $x % $y gives the remainder when $x is divided by $y. As a result, if (and only if) $x is exactly divisible by $y

Re: Redirecting the Output and Error of Perl script

2010-05-01 Thread Philip Potter
On 30 April 2010 18:45, Parag Kalra wrote: > Hey All, > > I am trying to execute a Perl via shell script. I want to redirect output of > Perl script to one file and error occured (if any) to other file. > > This is the snippet from my shell script: > > perl output_error.pl 1>> Report.log 2>>Error.

Re: ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-16 Thread Philip Potter
On 16 April 2010 14:38, Steve Bertrand wrote: > On 2010.04.16 09:15, Philip Potter wrote: >> What are you *actually* >> trying to do? What are you testing and why does this test require you >> to print output to the user under "make test"? > > This parti

Re: ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-16 Thread Philip Potter
On 16 April 2010 13:20, Steve Bertrand wrote: > I use prove often, usually when I want to quickly and non-verbosely (-Q) > work with a single test file that I'm currently adding new tests to, or > to ensure existing tests still pass if making changes to a function. > > What I want to be able to do

Re: how to create a hash on the fly

2010-04-16 Thread Philip Potter
On 16 April 2010 03:17, Steve Bertrand wrote: > On 2010.04.15 03:37, raphael() wrote: >> But as a beginning Perl programmer I find references extremely complicated. >> Although I have to learn them sometime. > > Although I Am Not A Programmer, if you do actually desire spending time > on writing P

Re: ExtUtils::MakeMaker, execute Perl code during "make test"

2010-04-16 Thread Philip Potter
On 16 April 2010 02:05, Steve Bertrand wrote: > On 2010.04.15 18:50, Steve Bertrand wrote: >> Hi all, >> >> In one of my projects, I've written a test file t/22-upgrade.t. > > [..snip..] > >> However, when I run "make test", the Perl code for print does not execute. > > Replying my own post, this

Re: free memory

2010-04-13 Thread Philip Potter
On 13 April 2010 16:25, Patrick Dupre wrote: > Hello, > > I have the a hash of hash of ... of array > (see below hwo I can list it) whose i wish to free the memory at one > point. Right now the desallocation is not clean, ie that evert time that > I reallocate the hash, the programme requires more

Re: the range of an array

2010-04-13 Thread Philip Potter
2010/4/13 WashingtonGeorge : > Sorry,my expressions had something wrong a moment ago.i wanted to say in > case i must to use a number bigger than 2**31-1,what should i do? Please quote the message you are replying to. If you have a dataset with more than 2**31-1 elements, you probably shouldn't b

Re: the range of an array

2010-04-13 Thread Philip Potter
2010/4/13 Xubo : > > thank you for responding to me,but supposing i want to use an array which > should includes plenty of elements,what should i do? Do you really need an array with > 2,000,000,000 elements? If you use such large arrays, you're probably not using Perl in the best way that you can

Re: the range of an array

2010-04-13 Thread Philip Potter
d-width integer, which means that it probably will only work with numbers up to around 2**31-1. But you probably shouldn't be using ranges that big anyway. Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Subroutine doesn't write to file

2010-04-12 Thread Philip Potter
On 12 April 2010 16:39, Uri Guttman wrote: >>>>>> "PP" == Philip Potter writes: > >  PP> On 12 April 2010 11:34, Shlomi Fish wrote: >  >> Hi Uri and Philip (and Abimael), >  >> On Monday 12 Apr 2010 10:32:36 Uri Guttman wrote: >  >

Re: Subroutine doesn't write to file

2010-04-12 Thread Philip Potter
On 12 April 2010 11:34, Shlomi Fish wrote: > Hi Uri and Philip (and Abimael), > On Monday 12 Apr 2010 10:32:36 Uri Guttman wrote: >>   PP> Where did I say PBP was always right? I just didn't want to let your >>   PP> style argument be the only one in this thread,

Re: Subroutine doesn't write to file

2010-04-12 Thread Philip Potter
On 12 April 2010 07:55, Uri Guttman wrote: >>>>>> "PP" == Philip Potter writes: > >  PP> On 12 April 2010 04:31, Uri Guttman wrote: >  >>>>>>> "AM" == Abimael Martinez writes: >  >> >  >>  AM>   prin

Re: Subroutine doesn't write to file

2010-04-11 Thread Philip Potter
On 12 April 2010 04:31, Uri Guttman wrote: >> "AM" == Abimael Martinez writes: > >  AM>   print {$tmp} "$div_start"; > > no need for the {} around a single scalar handle. But it *does* comply with Perl Best Practices #136. * It makes the filehandle obviously different from the other argumen

Re: Looping in Test::Harness

2010-04-09 Thread Philip Potter
On 9 April 2010 18:04, Bob McConnell wrote: > After a great deal of reading and speculation, it looks like YAML is the > way to go. I will have to move the loop inside each test script, and > iterate thorough the records read. The biggest problem is that the plan > is no longer fixed, so I do lose

Re: Decimal representation of binary file (unpack)

2010-04-08 Thread Philip Potter
On 8 April 2010 06:30, Raymond Wan wrote: > > Hi all, > > I would like to read in a binary file and extract the 4-byte ints from it. >  Under Linux, something like "od -t uI".  I got it working as follows: > > > my $buffer = ; > my @buffer = split //, $buffer; > for (my $i = 0; $i < length ($buffe

Re: about beginner perl site and developing skill

2010-04-06 Thread Philip Potter
On 6 April 2010 17:21, Rob Coops wrote: > On Tue, Apr 6, 2010 at 5:56 PM, Harry Putnam wrote: >> This doesn't actually have to be a paying job... I'm retired and do >> have an income.  But it would need to be a situation where I was >> expected to produce something on a continuing basis.  (Of cou

Re: Looping in Test::Harness

2010-04-06 Thread Philip Potter
On 6 April 2010 16:52, Bob McConnell wrote: > I have a test harness set up with a series of Selenium test scripts. > Each script tests a specific scenario on my web site. But I have some > scenarios that I want to test multiple times with different data entered > each time. Currently I am using en

Re: AW: about the various styles of `open'

2010-04-06 Thread Philip Potter
On 6 April 2010 16:48, Harry Putnam wrote: > Thanks for the effort, but I'm still a bit confused. Just need to > think it over some more maybe.  Is it fair to say that the `magic' > open is far and away the most common working case? And that the 3 arg > open is for unusual circumstances? No, gene

Re: free memory

2010-04-01 Thread Philip Potter
On 1 April 2010 16:13, Patrick Dupre wrote: > Hello, > > I cannot subscribe to perl-xs so, I am still posting here. I don't understand the problem. Firstly, I just emailed perl-xs-subscr...@perl.org and got a response from the mailing list software. Secondly, how come you were posting on perl-x

Re: good books for novice perl beginners

2010-03-25 Thread Philip Potter
On 24 March 2010 18:16, NAKO wrote: > Hello All, > > Can you please recommend some good books for novice beginners? Thanks http://learn.perl.org/books.html is a good start. The rest of the http://learn.perl.org/ website is worth a look too, which is why it's linked in the footers of this mailing

Re: Getting garbage fast

2010-03-24 Thread Philip Potter
On 24 March 2010 00:56, Eric Veith1 wrote: > Sam wrote on 03/23/2010 11:18:11 PM: >> Could you use a file of random data? You can create one of those really >> easy: dd if=/dev/urandom of=ranfile bs= > > Theoretically, yes, of course I could just try to create an arbitrary > sized file from /

Re: quick question

2010-03-19 Thread Philip Potter
On 19 March 2010 11:45, wrote: > On 19/03/10 13:19 +0200, Chris Knipe wrote: >> >> my ($foo, $bar) = 1 >> >> I am getting more and more occurances where when I use the later as above, >> $bar would not have a defined value...  I'm not quite sure I understand >> why. > > Does; > my ($foo,$bar) = 1

Re: Any Good SCM tool to manage Perl Code locally

2010-03-16 Thread Philip Potter
On 16 March 2010 06:44, Parag Kalra wrote: > Yes  I have started using Git and I am very happy with it so far. > > Just couple of questions - How can I make my code readonly using Git such > that it can be edited only when it is checked out. I don't understand the question. If you have source fil

Re: Angle bracket operator with list

2010-03-12 Thread Philip Potter
On 12 March 2010 09:17, Uri Guttman wrote: >>>>>> "PP" == Philip Potter writes: > >  PP> I found this code example on Stack Overflow to prettyprint a hash: >  PP> (link: >  PP> > http://stackoverflow.com/questions/2431032/how-to-print-a-

Angle bracket operator with list

2010-03-12 Thread Philip Potter
been a feature for some time, so it would surprise me if it's not documented anywhere, but I just can't find it. Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Mass value assigment

2010-03-09 Thread Philip Potter
On 9 March 2010 11:49, Shlomi Fish wrote: > Otherwise you can assign several variables the same initial value using the x > operator: > > my ($x, $y, $z) = (("test") x 3); > > Note that both pairs of parentheses on the right are required. Are the outer pair really required? I would have thought t

Re: Perl Hiding Username/Password

2010-02-11 Thread Philip Potter
On 10 February 2010 23:04, newbie01 perl wrote: > > Hi all, > > Can anyone please advise how I can change the following codes to work where > the and are not exposed? > Script is ran via crontab and can also be run manually, at the moment am > reading these values from some sort of delimited fil

Re: Clone an object

2009-12-28 Thread Philip Potter
2009/12/28 Philip Potter : > If you want to clone an object from a library > provided by someone else, you have to read its documentation and find > a clone object. This should be a clone method, of course. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional co

Re: Clone an object

2009-12-28 Thread Philip Potter
ocket: if you were able to clone the object, you could create two different objects which own the same socket; this is a Bad Thing. Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: regex question

2009-12-22 Thread Philip Potter
2009/12/22 Parag Kalra : > You can try following: > > $_ =~ s/^\.(\s)+//g; This isn't quite right. There are two ways in which you might use this substitution: either $_ will contain a single line, or it will contain multiple lines. The single line case might look something like this: while (<>)

Re: Git Talk by Randal

2009-12-19 Thread Philip Potter
2009/12/19 Erez Schatz : > One problem I have with Merlyn, is when he starts talking about > something, you're willing to throw everything away and go where he > points. He's such a passionate, compelling speaker. > My other problem is that he's mostly right. Who are you talking about? Is Merlyn s

Re: Git Talk by Randal

2009-12-19 Thread Philip Potter
2009/12/19 Parag Kalra : > Hello All, > > I know most of the big guns on this mailing list may already know this but > still felt like sharing this with you all specially for the beginers like > me. :) > >  A nice, very informative and well presented talk on Git given by our own > old gold Randal :

Re: capture error - the better way?

2009-12-18 Thread Philip Potter
2009/12/18 Peter Scott : > On Wed, 16 Dec 2009 10:09:38 +0000, Philip Potter wrote: >> Yes, it can't fold the constant. That's no excuse for changing the >> behaviour of the program. What it should do is what I wrote in my >> previous email -- replace it with code

Re: being smart about script structure

2009-12-16 Thread Philip Potter
2009/12/16 Bryan R Harris : > What's the difference between pointers and references?  Where can I read > about that difference? The key difference in my mind is this: Perl references are defined in terms of perl datatypes. C pointers are defined (more or less) in terms of memory locations. If you

Re: parsing template

2009-12-16 Thread Philip Potter
2009/12/16 Avani : > Hi all, > > I am very new to perl. I have to parse template in perl. > > do anybody have any reference code to do it? > > currently I am using regular expression. Right now, i m only able to > replace variables. HOw to do it for "for loop" and "if conditions" ? You may have to

Re: capture error - the better way?

2009-12-16 Thread Philip Potter
2009/12/16 Shlomi Fish : > On Tuesday 15 Dec 2009 17:14:25 Philip Potter wrote: >> If evaluating a constant expression results in a runtime exception, >> that runtime exception must happen at runtime, and not at compile >> time. In general, it is the duty of an optimizer never

Re: Comparing aggregates for equality when order doesn't matter

2009-12-15 Thread Philip Potter
2009/12/15 Shawn H Corey : > Philip Potter wrote: >> 1. Is there a "set" type which holds aggregate data and doesn't care >> about order, which I could use to compare these results for equality? > > You can use a hash as a set or a bag. Yeah I thought about

Comparing aggregates for equality when order doesn't matter

2009-12-15 Thread Philip Potter
Hi all, I have a method which returns two arrayrefs: one is an array of hashes, and the other an array of arrays. I'm writing a test harness for this method, so I put together some testcases and expected results. I don't care what order the arrays are in; I only care that the arrayrefs returned by

Re: capture error - the better way?

2009-12-15 Thread Philip Potter
2009/12/15 Shlomi Fish : > On Tuesday 15 Dec 2009 15:53:28 Philip Potter wrote: >> How can "Illegal division by zero" be a compile-time error? It seems >> clear to me that it's a run-time error, which the optimizer has >> (wrongly) decided to raise at compile-

Re: capture error - the better way?

2009-12-15 Thread Philip Potter
2009/12/15 Shlomi Fish : > On Tuesday 15 Dec 2009 14:25:28 Xiao Lan (小兰) wrote: >> On Tue, Dec 15, 2009 at 7:50 PM, Xiao Lan (小兰) > wrote: >> > I did have tried that, but this will get a runtime error. >> >> Sorry this is exactly a compile-time error. >> >> # cat except.pl >> >> eval { $x=12/0 };

Re: capture error - the better way?

2009-12-15 Thread Philip Potter
2009/12/15 Xiao Lan (小兰) : > On Tue, Dec 15, 2009 at 6:34 PM, Shlomi Fish wrote: >> You can use block eval {} instead of string eval "": > I did have tried that, but this will get a runtime error. > > # perl -e ' > eval { $x = 12/0 }; > if ($@) { print "0 div error" }' > > Illegal division by zero

Re: Windoze Woez

2009-12-12 Thread Philip Potter
2009/12/12 Shawn H Corey : > Alan Haggai Alavi wrote: >> Hi, >> >> Windows requires you to use double quotes in place of single quotes. Saving >> to >> a file and executing it is the only way that is cross-platform, I suppose. > > Doesn't Windows respond to here redirects? > > perl <> print "Hello

Re: Windoze Woez

2009-12-12 Thread Philip Potter
2009/12/12 Parag Kalra : > How is it going to new line without a new line character - '\n'. If I am not > wrong - 'q/ /' signifies quoted context thus - a replacement for double > quotes but still you should need a new line character to go to next line. q// is single quotes, qq// is double quotes.

Re: Windoze Woez

2009-12-12 Thread Philip Potter
2009/12/12 Parag Kalra : > Hello All, > > This works on Linux - > perl -e 'foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print "I am > only addicted to - 'Shekels' \n" if ($_ =~ /^s.*/i) }' > > This works on Windoze - perl -e "foreach (Sugar,Sex,Simplicity,Sleep,Success,Smoking) { print '

Re: being smart about script structure

2009-12-12 Thread Philip Potter
2009/12/11 Bryan R Harris : >>> Seems like a waste to do step 2 in a subroutine since we only do it once, >>> but it does fill the main body of the script with code-noise that makes it >>> harder to debug overall logic problems...  Not much logic here, but >>> certainly in more complex scripts. >>

Re: being smart about script structure

2009-12-11 Thread Philip Potter
2009/12/11 Bryan R Harris : > I'm not even sure how to ask this question, but here goes: > > I struggle knowing how to structure my code, what things belong as their own > subroutines and what things can stay in the main script.  How do the smart > guys make these decisions? > > For example, let's

Re: assign operator

2009-12-11 Thread Philip Potter
2009/12/11 Steve Bertrand : > Rafa? Pocztarski wrote: >> There is no := operator in Perl 5. In Perl 6 := is a run-time binding >> operator: >> >> $x = 1; >> $y := $x; >> $y = 2; >> >> Now both $x ==2 and $y == 2 >> In Perl 5 you use typeglob assignment to achieve the same thing: >> >> $x = 1; >> *

Re: Problem with break

2009-12-10 Thread Philip Potter
Perhaps break doesn't do what you think it does. Have you looked at perldoc -f break? Maybe last is what you meant instead? Type "perldoc -f last" to get its description, or google "perldoc last". Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.o

Re: matching an element from one array to another

2009-12-10 Thread Philip Potter
2009/12/10 John W. Krahn : > Noah wrote: >> >> Hi there, > > Hello, > >> I am hoping to figure out the best Way to write something.  I have two >> arrays @previous_hostnames and @hostnames. >> >> I want to figure out if there is at least one matching element in >> @previous_hostnames that is found

Re: Email does not send attachment ...

2009-12-09 Thread Philip Potter
2009/12/9 Sneed, Sean P : > Try the paths like this C:\\my_file.log Is there a reason that you suggested this? Perl under Windows, just like C and C++ under Windows, accepts / as a directory separator just fine. And if you stick to using / as your directory separator, porting to unix-based systems

Re: passing Hash to subroutine help please

2009-12-09 Thread Philip Potter
2009/12/9 John W. Krahn : > Jeff Pang wrote: >> >> Noah: >>> >>> sub exiting { >>>    my ($hostname, %login) = @_; >> >> Passing arguments like this has no such problem. >> But you'd better pass the hash as a reference to the subroutine. >> >> exitint($hostname, \%login); >> >> sub exiting { >>    

Re: Can I design a website using Perl

2009-12-06 Thread Philip Potter
2009/12/6 Parag Kalra : >> Question to the OP: Why have you decided to try things out in Perl? If >> it is because you've heard something like "Perl is better than PHP" >> then stop and try to find out *why* and *in what situations* is Perl >> better than PHP. In the situation of a simple webpage w

Re: Can I design a website using Perl

2009-12-06 Thread Philip Potter
2009/12/6 Erez Schatz : > This being said, anything you can do in PHP is available in Perl, PHP > being the "less talented brother" of Perl and all. For instance, for > embedding code tags in your HTML page, look no further than some > awsome and powerful Perl modules such as Template::Toolkit > (w

Re: I want to know the reason

2009-12-05 Thread Philip Potter
2009/12/5 Parag Kalra : > But this code is not working: > > #!/usr/bin/perl >> my @column_names=(A..ZZ); >> for(my $i=0; $i<26; $i=$i+1) { >>     my $tmp_file = "$column_names[$i]".".out"; >>     open $column_names[$i], ">column_names/$tmp_file" or die "Could not >> create the file - $tmp_file \n";

Re: Need to process a XML file through Perl.

2009-12-02 Thread Philip Potter
2009/12/2 Parag Kalra : > Currently I am planning to process the above requirement using simple Perl > regex. But I feel it can be made simpler using any of the available modules. > > So I have following questions: > 1.       Which are the best available XML modules for Perl? > 2.       Out of the

Re: CGI programming

2009-11-30 Thread Philip Potter
e decided by my system administrators. The only way you can find out is to ask the person who runs your machine. If they run an IT support website, have a look on there. Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h..

Re: Assignment Operator

2009-11-26 Thread Philip Potter
$temp2 + $constant; Notice that $temp2 has just been given the value of $global, so this second statement is the same as: $temp = $global + $constant; In other words, you're both right, because your version is equivalent to $temp = $global + $constant. Philip -- To unsubscribe, e-mail: be

Re: Code issue with perl5.10

2009-11-25 Thread Philip Potter
gt;{__PB_TEMPLATE_LIST}}[$#{$self->{__PB_TEMPLATE_LIST} }]->param( $param, $value ); Originally you had $...@{$foo}} which doesn't make sense to me. If $foo is an arrayref then to get the index of the last element of the array referent you use $#{$foo}. Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Documentation practices

2009-11-24 Thread Philip Potter
2009/11/24 Steve Bertrand : > I've noticed that the POD for several modules do not include method > usage for the functions/methods that are designed as 'internal-only'. > > I've reached a stage where not having POD for ALL of my methods is > becoming overwhelmingly cumbersome, as I have to read th

Re: Regex to get last 3 digits of a number.

2009-11-24 Thread Philip Potter
2009/11/23 Alan Haggai Alavi : > my $number = '0111'; > my ($index) = ( $number =~ /\d+(\d{3})/ ); > > $index would contain the last three digits: '111'. \d+ should be \d* above, otherwise you fail to match on 3 digit numbers: p...@tui:~/tmp$ perl -E ' my $number = q{111}; my ($index)

Re: how to write a debug-print sub with one argument?

2009-11-23 Thread Philip Potter
ng from your program, you just remove the "use Smart::Comments;" line and all smart comments become normal comments again. Unfortunately I can't tell you how to solve your original question; but I hope this fixes the underlying issue. Philip -- To unsubscribe, e-mail: beginner

Re: 答复: the question of one program

2009-11-20 Thread Philip Potter
2009/11/20 gaochong : > Thanks . > But the code is from cpan.org ,and is crappy ,where I will go ? CPAN has no quality control. There is no guarantee that anything you get from CPAN will not be, as you say, "crappy". As a result, be selective with what you download from CPAN. Ask questions, go by

Re: redirecting to a file in perl

2009-11-13 Thread Philip Potter
can't see your messages, only the person you reply to (in this case Dermot) can see them. I have only seen one message from you in this thread, so even if I wanted to and were able to help I can't, because I don't know what you're asking or having trouble with. Philip PS To the li

Re: Explicit return and anonymous hashes

2009-11-12 Thread Philip Potter
2009/11/12 Peter Scott : > On Thu, 12 Nov 2009 09:55:39 +0000, Philip Potter wrote: >> 2009/11/11 Shawn H Corey : >>> no warnings 'once'; >>> my @aoh = pairwise { +{ %{$a}, %{$b} } } @aoh_a, @aoh_b; >> >> Thanks for your response. What are the

Re: Explicit return and anonymous hashes

2009-11-12 Thread Philip Potter
2009/11/11 Shawn H Corey : > Philip Potter wrote: >> my @aoh = pairwise { { %{$a}, %{$b} } } @aoh_a, @aoh_b; > > no warnings 'once'; > my @aoh = pairwise { +{ %{$a}, %{$b} } } @aoh_a, @aoh_b; Thanks for your response. What are the grammar rules here? Why must I use

Explicit return and anonymous hashes

2009-11-11 Thread Philip Potter
'jim', 23, 'fred', 5, 'bar', 4, 'foo', 3, 'jim', 1729, 'fred', 1089 ]; Is this because the curlies are being interp

Re: hash keys and readable code

2009-11-11 Thread Philip Potter
2009/11/11 Uri Guttman : >>>>>> "PP" == Philip Potter writes: > >  PP>     my %readfsgs_flags; >  PP>     my @flags_to_copy = qw(limit); # can scale up by adding more hash > keys here >  PP>     @readfsgs_fla...@flags_to_copy} = @{$flag.

hash keys and readable code

2009-11-11 Thread Philip Potter
What is the Perlish way of doing things here? Thanks in advance, Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: the classic "which is the fastest way to sort" question

2009-11-09 Thread Philip Potter
2009/11/9 Michael Alipio : > Hi, >> >>  Do you need the fastest possible sort? > > I'm not even sure if I really need to worry about all these > sorting techniques. My program just reads a text file > (wordlist). It might be megabyte-sized or probably few > gigabytes (i might also add size checking

Re: the classic "which is the fastest way to sort" question

2009-11-09 Thread Philip Potter
rry to say, but this really will depend on your system. I don't know how Sort::Key works, but regarding all the other sorts, you'd have to measure it depending on your data and your system. Do you need the fastest possible sort? Philip PS your email client has a very long line length

  1   2   3   >