Re: charset problem using HTTP::Request on command line

2004-10-24 Thread Kevin Pfeiffer
Kevin Pfeiffer wrote: > I'm trying to fix a couple small problems in WWW::LEO.pm (accesses the Leo > German-English web server). One problem I can't solve. After switching to > my current Linux (SuSE) my leo script returns, for example: > > "merkwrdig" inst

charset problem using HTTP::Request on command line

2004-10-24 Thread Kevin Pfeiffer
not display) Perhaps this is because the command line is now UTF. The webpage encoding is charset=iso-8859-15. Looking at a dump of what HTTP::Request gives me I see: merkwrdigerweise Is there an easy way to convert the iso-8859-15 charset to UTF-8 (what I think my commandline is)? -K -- Kevin P

installing Perl scripts (not modules) to /usr/local/bin (how to do makefile)

2004-03-29 Thread Kevin Pfeiffer
. -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Makefiles for non-modules

2004-03-29 Thread Kevin Pfeiffer
I look at > (including Makefile.PL) seems to be geared to module installation. Meanwhile I found useful information in the perltidy package at CPAN. -K (hope this arrives) -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http:/

[no question, just greeting] hello perl.beginners

2004-03-09 Thread Kevin Pfeiffer
is is still justifiably the best newsgroup/mailing list out there. -K -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

good example of top-posting problem [Was RE: sorter script [was: Frustrated newbie question]]

2003-12-08 Thread Kevin Pfeiffer
This is a good example of the problem with top-posting; particularly in this list: I have no idea to which part of which poster your comment refers. Sorry about complaining (I try to ignore this behaviour), but it does cause problems in readability and comprehension (especially here). Not to menti

Re: How to process multi-line records ?

2003-12-08 Thread Kevin Pfeiffer
"Doe" $/ = ""; # treats empty line(s) as record terminator while() { if (m{DateField1:\s+$DateField1} || m{Name:.*$Name}) { print; } } -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: indirect file access

2003-11-09 Thread Kevin Pfeiffer
someone here will likely have a better answer) might be to run the script in setuid mode (use chmod to set permissions for script to '4755'); script will run as its owner instead as 'www-data'. -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: What is my name

2003-11-04 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Brian Gerard wrote: > And the clouds parted, and Kevin Pfeiffer said... [...] >> If I don't escape the slash in the char class -- i.e. /([^\/]+)$/ -- I >> get this error: >> Unmatched [ in regex; marked by <-- HERE in m/(

Re: Data::Dumper->dump()ing a hash?

2003-10-31 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Old wrote: [...] > Yeah, I guess that's it. I'm not really sure how it works (yet), but I > got it from Programming Perl. Here's that whole subsection: Thanks. I see I just need to "do my homework". -- Kevin Pfeiffer

Re: Data::Dumper->dump()ing a hash?

2003-10-30 Thread Kevin Pfeiffer
e supplied reference for hashes and arrays, and coderefs. The 1st sentence I understand, but not "the dereferenced type of the supplied reference." I just tried this without the asterisk and get "$entry" instead of "%entry" (or "$VAR1" using the plain procedure). So in plain(er) English that means: if the name begins with an "*", the output type will match that of the referenced variable"? -K -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Data::Dumper->dump()ing a hash?

2003-10-30 Thread Kevin Pfeiffer
in the form: > > $hash = { >album => "Prose Combat", ># etc... > } Try... use Data::Dumper print Dumper(\$hash_ref); (If I understood what you mean) -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: What is my name

2003-10-30 Thread Kevin Pfeiffer
1) If I don't escape the slash in the char class -- i.e. /([^\/]+)$/ -- I get this error: Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE ^/ at ./test-0 line 7. This makes no sense to me (since this is Perl and not sed or something)... (implied Question 2) -Kevin -- Kevin Pfe

Re: Corrupted Data

2003-10-30 Thread Kevin Pfeiffer
s way? Printing to a file handle that was opened for reading? -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Module Object and sub module function

2003-10-29 Thread Kevin Pfeiffer
kage Parent::Module::MyModule; You may not need it anymore, but for anyone else, I found the "Learning Objects, References & Modules" book to be really helpful with all this. -K -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: initializing a closure variable

2003-10-28 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > Kevin Pfeiffer wrote: >> >> I would have thought that this would initialize my $indent variable to 2 >> (like setting an initial state for an object), but if I call "indent()" I >> get nothing ba

Re: Parse and Compare Text Files

2003-10-28 Thread Kevin Pfeiffer
the rest." If you look at perldoc -f split and then try a couple tests, you should be able to get what you want. -Kevin (no expert though) P.S. - No top-posting please. -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

initializing a closure variable

2003-10-26 Thread Kevin Pfeiffer
$indent += $increment if $increment; return $indent; } } -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: initializing a closure variable

2003-10-26 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > Kevin Pfeiffer wrote: >> >> I would have thought that this would initialize my $indent variable to 2 >> (like setting an initial state for an object), but if I call "indent()" I >> get nothing back. :

Re: finding syntax errors

2003-10-26 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: > I've painted myself into a corner I can't get out of... > > Missing right curly or square bracket at /home/pfeiffer/bin/trash line > 341, at end of line > syntax error at /home/pfeiffer/bin/trash line 3

finding syntax errors

2003-10-26 Thread Kevin Pfeiffer
341 is, of course, the end of the file! The problem is, vim thinks that the syntax is just fine (without vim I'm nothing)! :-| Is there some trick to getting oneself out of this quagmire?? -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: 'rmm' (or 'trash') script

2003-10-25 Thread Kevin Pfeiffer
Hi David, In article <[EMAIL PROTECTED]>, David wrote: > Kevin Pfeiffer wrote: > >> Hi all, >> >> I just took another look at an exercise I wrote a couple months ago and >> fleshed it out a bit. It is a commandline "trashcan" program which I &g

'rmm' (or 'trash') script

2003-10-24 Thread Kevin Pfeiffer
mpty directories (which I ignored the first time I worked on this) and remembered from my objects book that I needed a recursive function to first clear out my directories. Amazingly, I actually remembered how to do this (okay, it's not that difficult, I know). Thanks, -Kevin -- Kevin Pfeif

Re: Deleting # and other characters

2003-10-23 Thread Kevin Pfeiffer
dfksdksdk Or this: s|\./||g; print; ...which produces this: a b dsfj/dfl/dksl ksdfl/dsld c d sds/dsl/dksld kdf/ksd/ksdk ...if that is what you want (I'm not quite sure). -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Deleting # and other characters

2003-10-22 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, Raghu Murthy wrote: > >> I need to remove ./ and #from a list of files. I can do it in sed but I >> am not able to use it in my perl script. I tried to do something like

Re: Deleting # and other characters

2003-10-22 Thread Kevin Pfeiffer
g like: while () { s|^#+\s*||; # remove leading #s and any spaces s|^\./||;# remove leading "./" print; } To remove the entire line add "next if " in front of the regex. -K -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Parsing pipe delimited file

2003-10-22 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, Charles K. Clarkson > wrote: > >> Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: >> >> : Where I am stuck is on the question: >> : >> : Given an @array s

RE: Parsing pipe delimited file

2003-10-22 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Charles K. Clarkson wrote: > Kevin Pfeiffer <[EMAIL PROTECTED]> wrote: > > : Where I am stuck is on the question: > : > : Given an @array such as > : ("Title of Song", "Artist", "Title", "A

Re: Parsing pipe delimited file

2003-10-22 Thread Kevin Pfeiffer
t;Title", "Another Artist", "etc"), is there an easy way to strip out the quotation marks. This sounds like something for a map function -- which I'm willing to work out for myself if you all think this is the best way. The arrays come from the line split mentioned just above (see "###" line). I'm splitting on "|||"s. -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to extract data in specified format to another file

2003-10-21 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: [...] > while () { > > chomp; > print; > last if /^0$/; > } > > print "\n"; Whoops, too fast for my own good (points off for carelessness): while () { chomp; print unless /^0$/; }

Re: how to extract data in specified format to another file

2003-10-21 Thread Kevin Pfeiffer
ame line? There is probably some subtlety of handling hexadecimal (just learned how to add and subtract it yesterday) that I'm overlooking, but on the surface, how about something as simple as: while () { chomp; print; last if /^0$/; } print "\n"; -- Kevin Pfeiffer

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: [...] > The thing to add (I'd have to check the Perl Cookbook for the terminology) > is a "reverse lookup"(?) so that in addition to: > > $album{$upc} > > you could also access your data via: > >

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
R WORLD"', '"12. I AM A MAN OF CONSTANT SORROW"', '"13. WRAPPED UP IN YOU"', '"14. NOT A DAY GOES BY"',

Re: Trivial 'unless' Question

2003-10-21 Thread Kevin Pfeiffer
;; >> >> True, but I was looking for a way to do this with a somewhat "buried" >> unless keyword. > > print +( qw(second first --> unless <--) )[ not $counter ]; ??? :-| -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
row out the first and last item. -K __DATA__ "ALL-TIME FAVORITE COUNTRY LOVE SONGS UPC#: 0-84296-33172-7"||"COUNTRY MALE PARTY SONGS VOL. 1 UPC#: 0-84296-21772-4"||"COUNTRY FEMALE PARTY SONGS VOL. 1 UPC#: 0-84296-21712-0"||| -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Parsing pipe delimited file

2003-10-21 Thread Kevin Pfeiffer
not the challenge of unwrapping, counting commas, pipes and quote marks, etc. I don't know if it's the best solution (perhaps an attachment is better), but I will usually send code unwrapped (during the rare moments when I have something to offer) and then hard-warp the 'splanatory&#x

Re: File sorting by a specific date

2003-10-21 Thread Kevin Pfeiffer
m wondering if there is a simple way of populating @files >> by using a date comparison operation of each file to the local time. I've >> tried long complicated methods of using 'stat' and Time::Local but I was >> hoping for a simpler solution. > > Ah, a simple

Re: Split multidimensional array into 4 multidimensional arrays

2003-10-18 Thread Kevin Pfeiffer
s formatted row foreach my $col (@{$_}) { printf "%16s|", $col; } print "\n"; } } -Kevin -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Description Search

2003-10-18 Thread Kevin Pfeiffer
ng program. Or, with the BLKKTL/Black Kettle mentioned earlier, maybe you can first detect a system of sorts (i.e. dropping vowels and double consonants)? Best would be to engage in some monopolistic price-fixing first and then you could match on price! ;-) -- Kevin Pfeiffer International U

Re: Split multidimensional array into 4 multidimensional arrays

2003-10-18 Thread Kevin Pfeiffer
gt; } > # yes, the above can be simplified a lot, if it bothers you > # but that is left as an exercise to the reader > } -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Split multidimensional array into 4 multidimensional arrays

2003-10-16 Thread Kevin Pfeiffer
foreach (@AoA1) { print "@{$_}\n"; } print "\n\n"; print "Array 2:\n"; foreach (@AoA2) { print "@{$_}\n"; } print "\n\n"; print "Array 3:\n"; foreach (@AoA3) { print "@{$_}\n"; } print "\n\n"; print &qu

Re: threads in perl

2003-10-12 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: [...] > What does the last line do. I looked at man threads: > $thread->join >This will wait for the corresponding thread to join. When the >thread finishes, join() will return the return values of &

Re: threads in perl

2003-10-12 Thread Kevin Pfeiffer
the thread finishes, join() will return the return values of the entry point function." Printing these out (i.e.): foreach (@kiddies){ $_->join(); print "$_ joined.\n"; } gives me: threads=SCALAR(0x81de948) joined. threads=SCALAR(0x81e180c) joined. e

Re: Regex apps

2003-10-11 Thread Kevin Pfeiffer
> Another one - regexEvaluater: Cool. Thanks to you both. I could have used these a day ago! :-) Something for the Perl.Beginners FAQ (oops, that'd mean I'd have to write one?). -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Perl and cron

2003-10-11 Thread Kevin Pfeiffer
homp is to remove line returns, but you don't have any How about: my @to_kill = ("`pgrep snp.pl`", "`pgrep snoop`"); > foreach (@snp) { > #print("Killing $_\n"); >`kill -9 $_`; --Shouldn't this be: system "kill -9 $_"; #?? > }

Re: Should loops return a value?

2003-10-08 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, R. Joseph Newton wrote: [...] > I'm not fond of this particular construct, but then, I'm not fond of grep, > either. I'd rather use something called get_all_matching(). Oh, you mean 'gam' ;-) -- Kevin Pfeiffer International U

RE: Elegant exit on the console

2003-10-07 Thread Kevin Pfeiffer
ce pop @line; print $clear_line, $prompt; print @line; } else { $history_ptr = 0; print $char; push @line, $char; } } ReadMode('normal'); I suspect that Term::ReadLine is the easier way to go but have not looked at it too closely

RE: instance variables?

2003-10-07 Thread Kevin Pfeiffer
ypercardish thing called TuxCards -- feeble brain. :-( Thanks for the tip! -K -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: list-parsing problem

2003-10-06 Thread Kevin Pfeiffer
uot;, @list, "\n"; produces output such as: a, a, b, c, whereas: print join(", ", @list), "\n"; produces: a a, b, c (no trailing comma) -- strange... I think I remember reading somewhere that without the parentheses 'join' doesn't really know exa

Re:

2003-10-06 Thread Kevin Pfeiffer
by inputting things like "eighteen dollars and 0 > cents" in a form with an explicit $ sign in front. As Joseph more or less said, error-trapping and verifying input is not the user's job (well, unless she's doing quality control work). Checking whether numerical input is

storing values non-globally

2003-10-05 Thread Kevin Pfeiffer
nd use it like an OO-method getter/setter. You call it with a value (file_mode("r") and it sets this value. You call it without any parameters and it returns the current value. Is this a valid alternative to global variables? -K -- Kevin Pfeiffer International University Bremen --

Re: extending modules

2003-10-01 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: [...] > This worked better and was easier (once I remembered to update 'ISA@') > than I expected! I ended up adding two or three new methods and modifying > four. Errr, ah "@ISA"... (that was the Hebrew not

how to know if a module is "stock" (i.e. comes with Perl install)

2003-10-01 Thread Kevin Pfeiffer
I have a feeling this a FAQ... I've CPANed so many modules I no longer know which came with Perl and which not. How can I determine this? Thanks in advance! -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Please clip text or not top-post [Was RE: Look At This Package]

2003-10-01 Thread Kevin Pfeiffer
here (makes following code and comments easier). -K -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: is there away to regex

2003-10-01 Thread Kevin Pfeiffer
you can) It's easier to see what is being done when they are separate. Even easier (I think) would be if you write: s|/\*|!|; # or s{/\*}{!}; -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: extending modules

2003-10-01 Thread Kevin Pfeiffer
ing to extend another method, and now that I've got these sorted out into two separate modules, it's quite easy. -K -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: extending modules

2003-09-30 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Jeff 'Japhy' Pinyan wrote: > On Sep 29, Kevin Pfeiffer said: [...] >>My working copy is now called AliasFilePlus. >> >>What do I do with this if I try to share it? The changes to the module >>seemed too great (and to

Re: extending modules

2003-09-30 Thread Kevin Pfeiffer
peace officers, to take either me or Doctor Slammer, of the 97th Regiment, at present quartered in Chatham Barracks, into custody, and thus prevent this duel!--I say, do not.' Mr. Snodgrass seized his friend's hand warmly, as he enthusiastically replied, 'Not for worlds!'

extending modules

2003-09-29 Thread Kevin Pfeiffer
has some good questions lately I see; I will try to catch up), -Kevin -- Kevin Pfeiffer International University Bremen Your message here -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: assigning a multi-dimensional array (mda) to an mda?

2003-09-29 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, R. Joseph Newton wrote: > Kevin Pfeiffer wrote: > >> I thought the easy way to do this is to first assign my entire 'en' data >> structure to the 'de' structure and then add 'de' values as available. >>

Re: Newbie Question! Can Someone help?

2003-09-27 Thread Kevin Pfeiffer
r aliases file and add this line. > support: root,"|/path/to/your/openticket.pl" > and than run, "newaliases" No, it reads /etc/aliases and updates the alias database; try 'man newaliases' for more info. -K -- Kevin Pfeiffer International University Bremen --

assigning a multi-dimensional array (mda) to an mda?

2003-09-27 Thread Kevin Pfeiffer
first assign my entire 'en' data structure to the 'de' structure and then add 'de' values as available. So I did this: $text{'main'}{'de'} = $text{'main'}{'en'}; $text{'main'}{'de'} = { # Germ

RE: instance variables?

2003-09-18 Thread Kevin Pfeiffer
this: And this actually works quite fine I think... > I hope that helps a little. > > Rob Thanks, that helped a lot! (Thank you also to others who responded.) Meanwhile my "naive ticketMachine" is chugging along. And I like doing the Perl version of something else; it's go

instance variables?

2003-09-18 Thread Kevin Pfeiffer
hat perhaps the difference is that in Perl you can call methods on a class (i.e. the "an unnamed horse" from the Perl Objects book) but not in Java (other than the contructor method)? (If anyone is interested in BlueJ -> www.bluej.org) -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

file permissions for modules

2003-09-14 Thread Kevin Pfeiffer
Hi all, (372 unread messages, I'm getting behind, again) If I understand things correctly, perl modules, i.e. "mymodule.pm" never need the exec bit set for (for example, wwwrun) - they're only used by another perl script? -K -- Kevin Pfeiffer International Univer

Re: case conversion problem

2003-09-11 Thread Kevin Pfeiffer
;> Another Company Name Ltd ** >> >> while retaining spaces. > > $text =~ s/(\w+)/\L\u$1/g;$y ^^ $y? A mysterious Perl variable that I've missed? -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: perl questions / exercices

2003-09-09 Thread Kevin Pfeiffer
two different sized arrays? Parsing URL Best thing is these queries will generate interesting ideas of things you could do for yourself. -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: checking for no input

2003-09-09 Thread Kevin Pfeiffer
is is what I was thinking of; I'll take a look. -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: version control and tracking?

2003-09-09 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Bob Showalter wrote: > Kevin Pfeiffer wrote: >> I occasionally see things in a script such as: >> # $Id$ >> >> I assume this is for some sort of automated version >> identification? I use >> use cvs, but end up having

OT: version control and tracking?

2003-09-09 Thread Kevin Pfeiffer
more info? -K -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: checking for no input

2003-09-09 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > "R. Joseph Newton" wrote: >> >> Kevin Pfeiffer wrote: >> >> > I'm looking at HTML::TokeParser. It expects a scalar with a filename or >> > a reference to a scalar containing the

checking for no input

2003-09-08 Thread Kevin Pfeiffer
;, @html); # pass scalar ref to module } else { die "Usage '$0 [filename]' or 'datasource | $0'\n"; } ...with the same result. -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Enumerating list of IP Addresses from a given range

2003-09-08 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > Kevin Pfeiffer wrote: >> >> In article <[EMAIL PROTECTED]>, John W. Krahn wrote: >> >> > You need to convert the IP address to a 32 bit integer and back again. [...] >> (But this includes num

Re: Extracting equal entities from two different sized arrays?

2003-09-08 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > Kevin Pfeiffer wrote: >> >> In article <[EMAIL PROTECTED]>, John W. Krahn wrote: >> >> > my $string1 = 'C:\Program files\directory1\directory2\directory3'; >> > my $string2 = &

Re: Enumerating list of IP Addresses from a given range

2003-09-07 Thread Kevin Pfeiffer
ue, "\n" ; last if $value eq $finish_address; if ($result[3] == 254) { # need to do carryover my $x; for ($x = 3; $x > -1; $x--) { if ($result[$x] == 254) { $result[$x -1]++; # carry over to next column $result[$x] = 0; # reset column } } } } print "\n"; __END__ (Comments, suggestions always welcome.) -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Extracting equal entities from two different sized arrays?

2003-09-07 Thread Kevin Pfeiffer
= split /\\/, $string2; my @diff; for (0 .. $length) { last if ($array1[$_] ne $array2[$_]); # avoid trailing / push @diff, "\\" if @diff; push @diff, $array1[$_]; } print "Common path", @diff, "\n"; -Kevin -- Kevin Pfeiffer International Univer

problem with PDF::Report and images (uses PDF::API2)

2003-09-07 Thread Kevin Pfeiffer
If I try with a gif, I get: sputnik:~/perl/pdf -> ./new_report > report-new.pdf image 'balloon.gif' has unknown format with signature '474946383961' at /usr/lib/perl5/site_perl/5.8.0/PDF/API2/Image.pm line 75. I've looked at the various modules (Gfx.pm, Image.pm) but see

Re: extra '1' returned while "building a horse"

2003-09-01 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Paul Johnson wrote: > > Kevin Pfeiffer said: [...] >> You'll see there is a "1" after the 'speak' routine's output (each time). >> I can't see where the "1" comes from. > > Your speak meth

extra '1' returned while "building a horse"

2003-09-01 Thread Kevin Pfeiffer
mmm ohhh well ahem); $sound[rand(5)]; } sub sound2 { "..." } } And I then write: my $john = Person->new("John"); print $john->speak("Hello"); This works fine except... sputnik:~/-> ./animals John says, "Hello"! 1sputnik:~/-> Y

Re: printing elements of an array

2003-08-31 Thread Kevin Pfeiffer
een each word there. One "quick and easy way": print "@foodlist\n\n"; -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: reverse range (10..1)

2003-08-31 Thread Kevin Pfeiffer
array = @array[ map abs(), -$#array .. 0 ]; >> print( join("\n", @array), "\n" ); >> Ctrl-D >> 5 >> 4 >> 3 >> 2 >> 1 [...] > *Vey* cool examples--especially the 'map' in the first one. > > Thanks! > > Paul Oh yeah, I'd really want to learn map before reverse... ;-) -K -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: writing back to a file

2003-08-31 Thread Kevin Pfeiffer
e one inner reference..." warning. Adding "undef $t" before the untie cured it. Seems to be a useful module. -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Cron jobs and perl

2003-08-29 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Vema Venkata wrote: > Hi Dan > > The problem still persisits pls. help/suggest me what to do ? Try comp.unix.admin -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text. Q: Why

RE: need help decompose word

2003-08-29 Thread Kevin Pfeiffer
ewlines & tabs). No need to filter twice I think (also from perldoc -f split): print "$_\n" foreach (split / */, uc $name); Only 505 unread messages to go... :-\ -K -- Kevin Pfeiffer International University Bremen A: Because it messes up the order in which people normally read text

RE: compare date,time

2003-08-27 Thread Kevin Pfeiffer
s > > my $t1 = str2time("12/08/2003, 11:00"); > my $t2 = str2time("13/08/2003, 23:00"); > > my $hours = ($t2 - $t1) / $hour; I just tried this (as written) and $t2 is not initialized. Any ideas why? (whoops, I think I know: locale) If I change the second da

RE: Sort -u emulation

2003-07-23 Thread Kevin Pfeiffer
ll necessariy have > a sort command and if it does -u may have a different meaning or it may > not exist at all. No, I'm not suggesting you use it, just comparing it with its replacement - on my command line typing "sort -u myfile" produces sorted output (as well as elimin

RE: Sort -u emulation

2003-07-23 Thread Kevin Pfeiffer
x27;t use strict; complain about @set? Heh, I think I just posted about this. Unless my memory deceives me, "@set{ @arr }" is a hash slice. That is, it's really %set (in 'batch' mode ;-)), which you have declared. I remember this because it seemed so strange at the time.

Re: Sort -u emulation

2003-07-23 Thread Kevin Pfeiffer
ch different is: my $file = 'file.txt'; { open my $fh, '<', $file or die "Cannot open $file: $!"; my %seen; my @unique = grep {!$seen{$_}++} <$fh>; } (Or, what does 'do' do here that I, too, should do 'do'?) Hmmmm, looking at

Re: Reordering Hash

2003-07-23 Thread Kevin Pfeiffer
quot;... (was in the book 'Hundred and One Uses for "@", "%" and "$"'). -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Create Perl Menu

2003-07-23 Thread Kevin Pfeiffer
re you thinking of a simple command line menu? *** Welcome to My Menu *** Today is Wednesday Users logged on: 1)pfeiffer 2)nobody CWD: /home/pfeiffer ** User to kill (enter #): ;-) If so, think about: perldoc -f write or perldoc -f printf (I thi

Re: ANNOUNCE: Ncurses programming examples

2003-07-22 Thread Kevin Pfeiffer
found for this URL. Could you correct and repost as this is > something I'd be interrested in. Try it with a tilde (he said): http://www.linux.lk/~anuradha/ http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mai

Re: Is there a better way?

2003-07-22 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Kevin Pfeiffer wrote: [...] > unless ($input =~ /^[^\D]+/ or $input eq '') { While messing around with the valid '' input problem I see I obfuscated the regex. I think this will do just fine: unless ($input =~ /^\d+/ or $input

Re: Is there a better way?

2003-07-21 Thread Kevin Pfeiffer
"); $intel_num_procs = join (" ", "-n", $num_procs) if $num_procs; sub get_input { my $prompt = shift; my $input =''; my $err_cnt = 0; { print $prompt; chomp($input = ); unless ($input =~ /^[^\D]+/ or $input eq '') { die "Invalid input, exiting\n" if ++$err_cnt > 2; redo; } } return $input; } -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

question about coderefs

2003-07-21 Thread Kevin Pfeiffer
routine needs to always come first -- or be in a BEGIN block? Thanks all! -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: date

2003-07-21 Thread Kevin Pfeiffer
4 2003 perldoc -f localtime -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: splitting an array into ???

2003-07-21 Thread Kevin Pfeiffer
ch (@array) { my ($key, $title, $url, $code) = split /\|/; # do other stuff... } -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

why no stat output via Perl for one file?

2003-07-21 Thread Kevin Pfeiffer
someone else will find this useful) -K -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

anyone found the code from the new "Learning Perl 2" O'Reilly book?

2003-07-21 Thread Kevin Pfeiffer
I posted to the O'Reilly errata page for this, but have not seen an answer yet. Has anyone else found the referenced code from the new Learning Perl Objects, References, and Modules book? -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED

range operator for matching

2003-07-16 Thread Kevin Pfeiffer
$on and not $off; $on++ if /line2/; } __DATA__ This is line1 some text on line2 line3 all about me good stuff on line4 line 5 isn't that great I'm on line 6 -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Regular Expression

2003-07-16 Thread Kevin Pfeiffer
m sure someone can do this more elegantly): if ($line =~ /[^(]*\(([^)]+)\)[^(]*\(([^)]+)\)/) { print "$1 and $2\n"; } -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

  1   2   >