Re: perl and java and html

2005-08-11 Thread Jan Eden
Sonia wrote on 03.08.2005: >Hi, I want to run PERL script which will combine several JAVA >applications. Furthermore, I need this script to run in the HTML >page. Is that possible? Can I run this locally on my machine, >without a server? > >Thanks Check out mod_perl (and Apache::SSI):

Re: perl modules on Mac

2005-08-06 Thread Jan Eden
Sagar Nargundkar wrote on 06.08.2005: >Hi, > >I was trying to install Math::Random and a few other modules on an >iMac G5 working on Mac OS X 10.4 but I had some trouble doing that. >The following message was displayed inspite of having administrative >pivilages - > >mkdir /usr/local/man: Permissi

OO design question

2005-08-06 Thread Jan Eden
Hi, I recently rewrote a program using OO techniques. Because my scripts usually do not exceed two hundred lines, I am not too familiar with OO design guidelines in Perl. So while I got everything to work (with the help of Randal's "Learning Perl ORM"), I am unsure about the preferred way to d

Re: Indirect method invocation

2005-07-27 Thread Jan Eden
Hi, Jan Eden wrote on 27.07.2005: >In other words, I would like to have something like the %actions >hash to construct a more flexible version of the $item->$mode() >construct, where I can pass different additional parameters to each >method. I finally came up with someth

Indirect method invocation

2005-07-27 Thread Jan Eden
Hi, it does not seem to be possible to use indirect method invocation with anything but a scalar. While this works: my $mode = $parameters{mode}; $item->$mode(); I cannot seem to find a proper bracketing to make this work: $item->$parameters{mode}(); Is my assumption correct? My other proble

Re: What does "unblessed reference" mean?

2005-07-26 Thread Jan Eden
Hi Dave, Dave Adams wrote on 26.07.2005: >I got this error that reads something like: Can't call method >"print" on unblessed reference at {script name} , chunk 1. > >In general terms, can anyone tell the what this is about so I can >comb through my script and fix this problem. > >Thanks in adva

Re: chdir and mkdir

2005-07-26 Thread Jan Eden
Randal L. Schwartz wrote on 26.07.2005: >The following message is a courtesy copy of an article >that has been posted to perl.beginners as well. > >>>>>> "Jan" == Jan Eden <[EMAIL PROTECTED]> writes: > >Jan> chdir "/some/dir";

Re: chdir and mkdir

2005-07-26 Thread Jan Eden
Xavier Noria wrote on 26.07.2005: >On Jul 26, 2005, at 11:31, Jan Eden wrote: >> But I wonder why my initial example works for you. File::Path doc >> says: >> >> 'The "mkpath" function provides a convenient way to create >> directories, ev

Re: chdir and mkdir

2005-07-26 Thread Jan Eden
Hi John, John W. Krahn wrote on 26.07.2005: >Jan Eden wrote: >> Hi, > >Hello, > >> this does not work: >> >> mkdir "/some/dir/newsubdir" or die "$!"; > >That works for me. What error message do you get? > I get "File exist

Re: chdir and mkdir

2005-07-26 Thread Jan Eden
Jan Eden wrote on 26.07.2005: >Hi, > >this does not work: > >mkdir "/some/dir/newsubdir" or die "$!"; > >while this does: > >chdir "/some/dir"; mkdir "newsubdir/" or die "$!"; > >In the shell, I can obviously execu

chdir and mkdir

2005-07-26 Thread Jan Eden
Hi, this does not work: mkdir "/some/dir/newsubdir" or die "$!"; while this does: chdir "/some/dir"; mkdir "newsubdir/" or die "$!"; In the shell, I can obviously execute the former. Is it true that in Perl, I can create a directory only within the current working directory? Thanks, Jan --

Re: Image::Magick speed issue

2005-07-24 Thread Jan Eden
Hi, zentara wrote on 24.07.2005: >On Sun, 24 Jul 2005 11:22:18 +0200, [EMAIL PROTECTED] (Jan Eden) >wrote: > >>Hi, >> >>I thought about using Image::Magick to create thumbnails for image >>galleries (either 10 or 5 thumbnails per page) on the fly and tested >

Image::Magick speed issue

2005-07-24 Thread Jan Eden
Hi, I thought about using Image::Magick to create thumbnails for image galleries (either 10 or 5 thumbnails per page) on the fly and tested the following: #!/usr/bin/perl use strict; use warnings; use Image::Magick; use CGI; my $q = new CGI; my %parameters = $q->Vars(); my $image = Image::Mag

RE: Hash reference structure

2005-07-21 Thread Jan Eden
Thanks, Xavier and Bob, that looks much better. Cheers, Jan Bob Showalter wrote on 21.07.2005: >Jan Eden wrote: >> Hi, >> >> I need to store a list of month names into a hash structure such that: >> >> $self->{monate}->{1}->{bezeichnung} = 

Hash reference structure

2005-07-21 Thread Jan Eden
Hi, I need to store a list of month names into a hash structure such that: $self->{monate}->{1}->{bezeichnung} = 'Januar' $self->{monate}->{2}->{bezeichnung} = 'Februar' etc. Until now, I have used the rather clumsy: @month_hash{1..12} = ("Januar", "Februar", "März", "April", "Mai", "Juni", "J

Re: setting variable in certain cases

2005-04-14 Thread Jan Eden
Hi, Offer Kaye wrote on 14.04.2005: >On 4/14/05, Jan Eden wrote: >> >>In example 1, I have to set the variable explicitly 5 times, in >>example 2, I have to manually list all cases outside the switch >>statement, which bears the risk of forgetting to modify the line

setting variable in certain cases

2005-04-14 Thread Jan Eden
Hi, I have a switch statement containing 10 different cases. in 5 of the cases, I need to set a variable to a certain value. The ways I could think about are: - setting the variable within each case statement, e.g. case 'slurp' { $parameters{type} = 'gallery'; ... } - use a se

Re: system trouble

2005-04-11 Thread Jan Eden
Robin wrote on 12.04.2005: >On Tuesday 12 April 2005 00:31, Jan Eden wrote: >> system ("webalizer", "-c ./webalizer.conf", >> "/Users/jan/Sites/apache_logs/$file"); } >> } >> closedir(DIR); >> >> webalizer complai

system trouble

2005-04-11 Thread Jan Eden
Hi, I have to do some log processing with webalizer and tried to do the following: #!/usr/bin/perl use strict; use warnings; opendir(DIR, "/Users/jan/Sites/apache_logs") or die "Cannot open directory"; while (defined(my $file = readdir(DIR))) { if ($file =~ /^www/) { print "Processi

Re: YA Regex problem: lookahead assertion

2005-03-24 Thread Jan Eden
Offer Kaye wrote on 23.03.2005: >Change your RE to: m#(.+?)(.+?)(?=|$)#gs > >In other words, look ahead to either a or the end of the string >("$"). I have to admit this problem wasn't as simple as I initially >thought - I still have no idea why my first guess didn't work: >m#(.+?)(.+?)(?=)?#gs >

YA Regex problem: lookahead assertion

2005-03-23 Thread Jan Eden
Hi, I use the following regex to split a (really simple) file into sections headed by .+?: while ($content =~ m#(.+?)(.+?)(?=)#gs) { ... } This works perfectly, but obviously does not catch the last section, as it is not followed by . How can I catch the last section without * doing a se

Re: Problems using open pragma

2005-03-18 Thread Jan Eden
Hi, Jan Eden wrote on 18.03.2005: >Hi, > >I have a bunch of files in the iso-8859-1 text encoding which I want >to save (in an edited form) as UTF-8. > >I use the following line: > >use open IN => ':encoding(iso-8859-1)', OUT => ':utf8'; > >

Problems using open pragma

2005-03-18 Thread Jan Eden
Hi, I have a bunch of files in the iso-8859-1 text encoding which I want to save (in an edited form) as UTF-8. I use the following line: use open IN => ':encoding(iso-8859-1)', OUT => ':utf8'; and it does not work. This is strange, as I use this pragma all the time, and it always worked. Whe

Re: Generating a hierarchy path

2005-02-12 Thread Jan Eden
Hi Ovid, Ovid wrote on 11.02.2005: >Hi Jan, > >Apologies in advance if any of this seems too pedantic. > I was asking for pedantic remarks. ;-) >What you are essentially looking for is SQL capable of handling tree >structures so you can pull this data in a single fetch. You can >read about this

Re: Logfile name

2005-01-25 Thread Jan Eden
Owen wrote on 25.01.2005: >On Mon, 24 Jan 2005 14:31:53 +0100 Jan Eden <[EMAIL PROTECTED]> >wrote: > >>Hi, >> >>I create monthly log files with names like statistics_01_2005.log. >>Now I have a function which returns the logfile name for the current >>

Logfile name

2005-01-24 Thread Jan Eden
Hi, I create monthly log files with names like statistics_01_2005.log. Now I have a function which returns the logfile name for the current month: sub statfile { my @date = localtime(time); my ($month, $year) = @date[4,5]; $year += 1900; $month = sprintf ("%02d", $month+1);

Re: Precedence confusion

2005-01-13 Thread Jan Eden
Hi John, John W. Krahn wrote on 13.01.2005: >Jan Eden wrote: >>It also does not show up if I enclose the ternary operator in >>brackets: >> >>my $server = shift || ($string =~ /(foo|bar)/ ? $1 : 'default'); >> >>While this solves my problem, I st

Precedence confusion

2005-01-13 Thread Jan Eden
Hi, I wrote the following: #!/usr/bin/perl -wT use strict; my ($server) = sitemode("test"); print $server; sub sitemode { my $string = "foonky"; my $server = shift || $string =~ /(foo|bar)/ ? $1 : 'default'; return $server; } Now this throws an error. The error does not occur when

Re: Reading uploaded files and text blocks

2004-12-10 Thread Jan Eden
Jan Eden wrote on 10.12.2004: >I am also a little confused about which line endings come with text uploaded >via >a textarea. I use: > >my $input = $q->param('input'); >$input =~ s/[\r\n]{2,}/\n/g; >my @urls = split /\n/, $input; > >to make

Reading uploaded files and text blocks

2004-12-10 Thread Jan Eden
Hi, I use the following to read in lines from an uploaded file: my $fh = $q->upload('input_file'); while (<$fh>) { push @urls, $_; } It works fine when the file has UNIX or DOS linebreaks, but it fails with Macintosh linebreaks. What is the best method to read in a Macintosh file (othe

Re: Reading uploaded files and text blocks

2004-12-10 Thread Jan Eden
Jan Eden wrote on 10.12.2004: >Hi, > >I use the following to read in lines from an uploaded file: > >my $fh = $q->upload('input_file'); >while (<$fh>) { push @urls, $_; } > >It works fine when the file has UNIX or DOS linebreaks, but it fails &

cpan vs. perl -MCPAN -e

2004-12-10 Thread Jan Eden
Hi, I used to use perl -MCPAN -e "install 'Some::Module'" to install modules. Now I discovered the cpan tool (by chance) which allows me to do: cpan Some::Module The manual page (date: 2003-09-12) is pretty self-explaining - but the script was never mentioned on this list. Is there any reas

Re: Regex question (once again)

2004-12-03 Thread Jan Eden
Hi, sorry! Overlooked the g switch, so the first parentheses captures either nothing or the initial \\begin{letter}. I got it now. Thanks again, Jan -- These are my principles and if you don't like them... well, I have others. - Groucho Marx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Regex question (once again)

2004-12-03 Thread Jan Eden
Hello John, John W. Krahn wrote on 03.12.2004: >Jan Eden wrote: >> Hi, > >Hello, > >> I have lines like the following: >> >> \begin{letter}{Name\\ Street\\ ZIP\\ Country} >> \begin{letter}{Name\\ Street\\ ZIP} >> >> To extract the info

Regex question (once again)

2004-12-03 Thread Jan Eden
Hi, I have lines like the following: \begin{letter}{Name\\ Street\\ ZIP\\ Country} \begin{letter}{Name\\ Street\\ ZIP} To extract the info, I used my ($data) = $file_content =~ /\\begin{letter}{(.+?)}/; my ($name, $street, $zip, $country) = split / /, $data; But I wonder if this is also po

Re: Passing options to command in a system call

2004-10-01 Thread Jan Eden
Thanks, Errin, Doug and Bob, Errin Larsen wrote on 01.10.2004: >On Fri, 1 Oct 2004 17:41:50 +0200, Jan Eden <[EMAIL PROTECTED]> >wrote: >>How can I pass an option to system's first argument in a setting >>like this? > >This is ironic: > >>If all else

Passing options to command in a system call

2004-10-01 Thread Jan Eden
Hi, I try to call wget using system like this: system("wget -O /dev/null", "http://janeden.org/test/file.txt";); This does not work: Can't exec "wget -O /dev/null": No such file or directory at ./wgetrec.pl line 6. Ok, so how about this: system("wget", "-O /dev/null http://janeden.org/test/fi

Re: How to accumulate Hashes of Array value with the same key?

2004-10-01 Thread Jan Eden
Edward Wijaya wrote on 01.10.2004: >On Thu, 30 Sep 2004 14:23:47 -0300, Shaw, Matthew <[EMAIL PROTECTED]> >wrote: > >Thanks Matt, > > >>> > my %HoA = (key1 => ['A',1]); >>> > my %HoA2 = (key1 => ['B',2]); >>> > my %HoA3 = (key1 => ['C',2]); >>> > >>> > into: >>> > > >Only this one works > >>> push

Re: How to accumulate Hashes of Array value with the same key?

2004-10-01 Thread Jan Eden
Edward Wijaya wrote on 01.10.2004: >On Thu, 30 Sep 2004 14:23:47 -0300, Shaw, Matthew <[EMAIL PROTECTED]> >wrote: > >Thanks Matt, > > >>> > my %HoA = (key1 => ['A',1]); >>> > my %HoA2 = (key1 => ['B',2]); >>> > my %HoA3 = (key1 => ['C',2]); >>> > >>> > into: >>> > > >Only this one works > >>> push

Re: Trouble with m///g

2004-09-30 Thread Jan Eden
Chap Harrison wrote on 30.09.2004: > >On Sep 30, 2004, at 9:55 AM, Wiggins d Anconia wrote: > >> Out of curiousity based on your description shouldn't it return, >> >> ::::::: >> >> Or do you really mean, you are trying to capture all 4 digit strings >> that are not

Re: CC mit Mailprog funktioniert nicht

2004-09-15 Thread Jan Eden
Hallo Reinhold, Reinhold Riedersberger wrote on 10.09.2004: >Hallo , > >ich habe ein für mich seltsames Problem: > >Mit dem untenstehenden Programmteil habe ich früher (meine ich >zumindest) erfolgreich eMails nebst CC versendet. Seit mir unbekannter >Zeit wird aber nur noch der To-Empfänger amg

RE: Merging lines in a file

2004-08-29 Thread Jan Eden
Hi, thanks for all the suggestions. I originally tried to avoid slurping the whole file into memory, but got stuck using the $. variable to address a line and the one following it. Thanks John and Gunnar for pointing me to the right direction, and thanks to Charles for his extensive comments.

Merging lines in a file

2004-08-29 Thread Jan Eden
Hi, I had the following task: Open a file, read it and merge all pairs of lines containing a certain number of tabs. Example: Blablabla abc cab bca 123 453 756 Blablabla Blablabla Here, lines 2 and three should be merged, while the other lines should remain untouched. Expected result: Blablab

Re: new window on redirect

2004-07-13 Thread Jan Eden
Tim McGeary wrote on 13.07.2004: >Wiggins d Anconia wrote: > Sort of. What I don't understand is why do you have to decide on the server side, post-request that the result will be in a new window? Couldn't the original "portal" page just use targets like normal? >>> >>>It's a data

Re: __DATA__ Token Problem

2004-07-05 Thread Jan Eden
Hi Bastian, Bastian Angerstein wrote on 05.07.2004: >Hello, > >I have a few questions regarding to the DATA Filehandle: > >1. This handle ist opend by default or do I have to open it by >myself? > According to the docs, it should be opened by the __DATA__ token: >The __DATA__ token opens the DA

RE: displaying to_char formatting in Perl

2004-05-27 Thread Jan Eden
Hi Nancy, MCMULLIN, NANCY wrote on 27.05.2004: >The error is "Internal Server Error". >As soon as I comment out the (2)lines below: >-- TO_CHAR(ie_dollar_amt, '$999,999.99'), >it works just fine. As suggested before: use CGI::Carp qw(fatalsToBrowser); You'll get a more informative error messag

Re: Line number

2004-05-27 Thread Jan Eden
Hi Jon and Jose, Jose Alves de Castro wrote on 27.05.2004: >On Thu, 2004-05-27 at 10:10, Jon Herbry wrote: >>Hi, anybody have idea find the number in a file? Assume I create a >>file call >"sample" >>and have content below: Hi, >>Jame where are you? How old a

Re: DBI and fetchrow

2004-05-27 Thread Jan Eden
MCMULLIN, NANCY wrote on 26.05.2004: >Does anyone know why this script hangs when it's executed? It's >probably due to the complex select statement, but I'm not sure how >to make it work. > >Also, is there a good 'DBI with SQL with Perl' book out there? > John already recommended O'Reilly's 'Pr

RE:How to find same filename in subdirectory

2004-05-26 Thread Jan Eden
Hi, [EMAIL PROTECTED] wrote on 26.05.2004: >Hi, John thanks you comment, the coding is work. But i'm detect have >some small problem in line 7 print "$File::Find::name\n" if $_ eq >'File1'; I test as below sample 2 is follow you coding. From here i >detect nothing return from script. > >But after

Re: Finding a string in a file

2004-05-25 Thread Jan Eden
Debbie Cooper wrote on 25.05.2004: >I need to search for the occurrence of a string in a file that is >buried in directories. So, for example, I have a directory >structure that looks like this C:\data\elec\1\220\webdata.tab. The >last three folders change frequently so I can have >c:\data\appl\

RE: How to find files in subdirectory

2004-05-25 Thread Jan Eden
LKTee wrote on 25.05.2004: >Hi, after refer the File::Find, I write the script below: > >#!/usr/bin/perl >use warnings; >use strict; >use File::Find; >find ( \&callback, "/") ; > >sub callback{ > print $File::Find::name, "\n"; >} > >but this script will list all the filename, from the disk. So,

Re: How get a special value of an arrayfield stored in an hash?

2004-05-24 Thread Jan Eden
Hi Bastian, Bastian Angerstein wrote on 24.05.2004: >I tought: >$index = 1 > >$var = ${$myhash{mykey}}[$index]; > >would do the trick. > >But it don´t. > > >Any suggestions? > > Your syntax implies that there already is an anonymous array stored as value of $myhash{mykey}. You assign the second

RE: Problem with use strict;

2004-05-20 Thread Jan Eden
MCMULLIN, NANCY wrote on 14.05.2004: >But when I run the same code with use strict commented out - it >works just fine... A little late maybe, but CGI::Carp might be something for you. Its method fatalsToBrowser sends Perl's error messages to your browser window. HTH, Jan -- These are my prin

Re: do problem

2004-05-03 Thread Jan Eden
Daniel, Daniel Staal wrote on 29.04.2004: >--As of Thursday, April 29, 2004 10:43 AM +0200, Jan Eden is alleged >to have said: > >>I have a piece of HTML code containing two Perl variable names, >>which is to be used in 6 scripts. So I tried to put it into a >>separa

RE: HTML::Entities issue

2004-04-29 Thread Jan Eden
Hi Charles, Charles K. Clarkson wrote on 29.04.2004: >Jan Eden <[EMAIL PROTECTED]> wrote: >It may be an issue with your terminal software. Is >your terminal the place you expect to display results >of a script like this? Have you tried it under a >different terminal

Re: do problem

2004-04-29 Thread Jan Eden
Hi Rob, Rob Dixon wrote on 29.04.2004: >Jan Eden wrote: >>The obvious problem is, that the variables are not interpolated >>according to their current value in the scripts, i.e. although >> >>$mother_id = 453; and $title = "Title"; >> >>The $p

HTML::Entities issue

2004-04-29 Thread Jan Eden
Hi all, I have the following script (just a test): --- #!/usr/bin/perl -w use strict; use HTML::Entities; my $string = 'Alfred Döblin: Berlin Alexanderplatz'; my $string2 = 'Alfred Döblin: Berlin Alexanderplatz'; $string = decode_entities($string); print $string, "\n", $string2, "\n"; --- T

do problem

2004-04-29 Thread Jan Eden
Hi all, I have a piece of HTML code containing two Perl variable names, which is to be used in 6 scripts. So I tried to put it into a separate file to be executed with "do page_head.pl", where page_head.pl contains something like (simplified): my $page_head = qq{http://www.w3.org/TR/xhtml1/DTD/

Re: Perl and images

2004-04-27 Thread Jan Eden
Wiggins d Anconia wrote on 27.04.2004: >>Now the installation instructions tell me to >> >>>edit Makefile.PL and change LIBS and INC to include the >>>appropriate path information to the required libMagick library. >>>You will also need library search paths (-L) to JPEG, PNG, TIFF, >>>etc. librari

Re: Perl and images

2004-04-27 Thread Jan Eden
nat wrote on 27.04.2004: >earlier <[EMAIL PROTECTED]> wrote... > >> Hi all, >> >> I need to convert JPEGS to Grayscale TIFS >> Large Size JPEGS. >> >> Which is the best module I should opt for ? > >Imagemagick is really good. > >http://www.imagemagick.org/www/perl.html > Funny, I ju

Re: OOPS!!

2004-04-26 Thread Jan Eden
Sumanth Sharma wrote on 26.04.2004: >Hi All, > >I am quite ok with perl. But How do i learn Object oriented perl. > >It's so different from C++ of Java. I sort of went thro the perlboot. > >It looks not too friendly. > >How best can I learn Object orientd perl. Randal Schwartz: Le

RE: joining lines

2004-04-23 Thread Jan Eden
Charles K. Clarkson wrote on 23.04.2004: >Jan Eden <[EMAIL PROTECTED]> wrote: >: >: Jeff 'japhy' Pinyan wrote on 23.04.2004: >: >: ># read 6 lines from IN and put them in @record >: >my @record = map scalar(), 1 .. 6; >: >: How does this

Re: joining lines

2004-04-23 Thread Jan Eden
Jeff 'japhy' Pinyan wrote on 23.04.2004: ># read 6 lines from IN and put them in @record >my @record = map scalar(), 1 .. 6; How does this work? In the map function you gave, the first argument is scalar, which takes only one argument and returns a line from INPUT in scalar context. But

Re: Perl vs PHP

2004-04-22 Thread Jan Eden
Ron B wrote on 22.04.2004: >Why would one prefer Pepsi over Coke, or vice versa? :) That's the >answer to your question. > >[EMAIL PROTECTED] wrote: >>Why would one prefer PHP over PERL, or vice, versa? I'm guessing >>PERL has more functionaltiy and is more robust. What are the >>technical argum

RE: Date calculation

2004-04-22 Thread Jan Eden
Hi Joel, - Original Message - From: Stout, Joel R Sent: 21.04.2004, 17:46 Uhr >Call me crazy but I have visions of people asking for Winter >discounts or various future changes (prolonged Summer rates?). What >of a simple text file that contains: > > >0914|80 >0915|80 >0916|55 >0917|

Re: Date calculation

2004-04-22 Thread Jan Eden
Hi Chris, - Original Message - From: Chris Charley Sent: 21.04.2004, 18:48 Uhr >Hello Jan >Maybe something like this would do what you want :-) > >#!/usr/bin/perl >use strict; >use warnings; >use Date::Calc qw/Delta_Days Date_to_Days Add_Delta_Days/; > >my $beg = Date_to_Days(2004, 7, 1

Re: Date calculation

2004-04-21 Thread Jan Eden
- Original Message - From: WC -Sx- Jones Sent: 21.04.2004, 14:23 Uhr >Jan Eden wrote: > >> if (season($start_date) && season($end_date) { >> $season_days = Delta_Days($start_date, $end_date) >> } elsif season($start_date) { > > >try not to ma

Re: Date calculation

2004-04-21 Thread Jan Eden
- Original Message - From: WC -Sx- Jones Sent: 21.04.2004, 13:32 Uhr >Jan Eden wrote: >> if $mmdd > 0915 and $mmdd < 0630) ... >> >> in my calculation to allow for any combination of $80 and $55 days. > >(($mmdd > 0915) && ($mmdd < 0630

Date calculation

2004-04-21 Thread Jan Eden
Hi, I need to find the number of days between two dates. The Perl Cookbook provides this solution: use Date::Calc qw(Delta_Days); @bree = (1981, 6, 16); # 16 Jun 1981 @nat = (1973, 1, 18); # 18 Jan 1973 $difference = Delta_Days(@nat, @bree); But there's a hook: I need to calculate a

Re: Feeding an array

2004-04-21 Thread Jan Eden
Hi Ben, - Original Message - From: Ben Miller Sent: 21.04.2004, 9:16 Uhr >Hi Jan, > >Thanks for your help. That's what I need. I had tried something >similar earlier using () to surround the variable rather than []. My >next question is: when I try to print a specific member of the array

Re: Feeding an array

2004-04-21 Thread Jan Eden
Hi Ben, - Original Message - From: Ben Miller Sent: 21.04.2004, 7:49 Uhr >Hello, > >This is my first post and I'm working on my first real Perl program. >I'm trying to feed an array using information scraped off another >web page. I've got the scraping working no problem, but each of the

Re: Problem with Code

2004-04-21 Thread Jan Eden
>c:\proggy/filelisting.txt >c:\proggy/linecount.pl >c:\proggy/list.txt >c:\proggy/list2.txt >c:\proggy/lister.pl >c:\proggy/orig.pl > >Any help appreciated. > >Jane > > >- Original Message - >From: "Jan Eden" <[EMAIL PROTECTED]> >To:

Re: Problem with Code

2004-04-21 Thread Jan Eden
Hi Jane, - Original Message - From: Ryan Thomas Sent: 21.04.2004, 12:18 Uhr >Hello All > >I have a script below that lists a directory tree structure (thanks for the base >code Jan!)and have modified it, unsuccessfully, to add the file size. > >What have i done wrong ?? > >The output I a

Re: Directory Listing

2004-04-21 Thread Jan Eden
Hi Jane, - Original Message - From: Ryan Thomas Sent: 21.04.2004, 11:09 Uhr >I am relatively new at PERL and am learning it for a school project. What I >would like to do is write a perl script that can run a complete directory >listing including sub-directories and save the result to a

RE: Determining site root

2004-04-19 Thread Jan Eden
- Original Message - From: Charles K. Clarkson Sent: 19.04.2004, 8:24 Uhr >:But now I had to change the layout and embed some sites. Their site >:roots and template location are now >: >:'~/Sites/janeden/whatever' and >:'~/Sites/janeden/whatever/templates/whatever.tpl' >: >:I temporarily

Re: Determining site root

2004-04-19 Thread Jan Eden
- Original Message - From: WC -Sx- Jones Sent: 19.04.2004, 9:00 Uhr >Jan Eden wrote: >>But now I had to change the layout and embed some sites. Their site >>roots and template location are now >> >>'~/Sites/janeden/whatever' and >>'~/Sites

Determining site root

2004-04-19 Thread Jan Eden
Hi fellows, I have written a little script to update a bunch of HTML files. I know I could (maybe should) use a module such as HTML::Template, but my script worked fine until now. Each site updated with the script has a root directory and a template, which are determined according to a meta tag

Re: [Fwd: Re: Regular expression to replace whitespace with comma]

2004-03-12 Thread Jan Eden
Distribution Lists wrote: > >Thanks but I've that already try that > >C:\temp>perl -pi.bak -e "s/\s+/,/g" tempfile.out > >C:\temp>more < tempfile.out >Server,Drive,FSTYPE,Size,Free,Used,SERVER1,C$,NTFS,4095,296,3799,SERVER1,D$,NTFS >,4001,1908,2093,SERVER1,C$,NTFS,38123,29808,8315, > >The only th

Re: trouble with writing to file

2004-03-03 Thread Jan Eden
incognito wrote: >Thank you for your attention, Bob. > >>What is your actual regex? At a minimum, you'll need /g modifier. >>You may need /m and/or /s as well. > >May be I didn't explained my prob exactly. I don't have a problem >with the regex (and yes, I have the /m /g and /s). Related to the >

Re: question plz

2004-02-21 Thread Jan Eden
[EMAIL PROTECTED] wrote: >$hash_ref = {key => "value", key2 => "value2"}; >print $hash_ref->{key}; > >It will go and get the 'key' key from the hash that $hash_ref points >to. The print function will actually print "value" here, since you requested the value identified by key. - Jan -- The da

Re: Why does this keep happening?

2004-02-18 Thread Jan Eden
Joel wrote: >I fixed the source code with the suggestions given, but still no luck. Any >other ideas? > >Joel >--- >#!usr/bin/perl > >$abc=1000 > >until ($abc==0) >{ >print "Counting down to 0 from $a\n"; >$a--; >} >print "Blast off!"; > Apart from the miss

Re: shorten code

2004-02-17 Thread Jan Eden
James Edward Gray II wrote: >On Feb 17, 2004, at 3:13 PM, Jan Eden wrote: > >> >> Rob Dixon wrote: >>> >>> my @data = map { tr/%//d; [split] } split /\n/, $str; >>> >> >> A little late maybe, but... >> >> Why do you have

Re: shorten code

2004-02-17 Thread Jan Eden
Rob Dixon wrote: > > my @data = map { tr/%//d; [split] } split /\n/, $str; > A little late maybe, but... Why do you have the second (in the order of operation) split operator in brackets? Shouldn't it just split $_ on whitespace if no arguments are given? - Jan -- If all else fails read the

Re: How to rearrange an array by a hash

2004-02-16 Thread Jan Eden
John W. Krahn wrote: >Shiping Wang wrote: >> >> Hi, > >Hello, > >> How can I rearrange an array in a specific order based on the order of a >> hash? Something like this: >> >> my @a = qw(Mary John Dan); >> print join "\t", @a, "\n"; >> >> my %b = ( John => 0, >> Dan => 1, >> Mary => 2); >> >>

Re: getting in between dates in a hash

2004-02-16 Thread Jan Eden
Joseph Alotta wrote: >Greetings, > >I am having some conceptual problems doing what I think is a fairly >simple perl task. It is probably that my mind is just blank on >this. Could someone please recommend a strategy for this. > >I have a hash of data: > >%highest_level = ( 2001-10-14 => 152,

Re: Updating a text file

2004-02-16 Thread Jan Eden
R. Joseph Newton wrote: >Jan Eden wrote: > >>Hi, >> >>[EMAIL PROTECTED] wrote: >> >>>I have a text file with a records like: >>> >>>smith, James, Dr., 115 Fourth Street, Chicago, IL, 32012, $20.00: >>>[EMAIL PROTECTED] >>&g

Re: Looking up values in arrays?

2004-02-15 Thread Jan Eden
Hi, Benjamin Walkenhorst wrote: >Hello, > >On Sun, 15 Feb 2004 20:50:59 +0100 >Paul Johnson <[EMAIL PROTECTED]> wrote: > >> > I'm sure something like this exists. Or do I need to write this >> > myself? >> >> Something close exists. I think I'd probably code it as: > >Thanks a lot! =) > >Kind r

Re: Updating a text file

2004-02-15 Thread Jan Eden
Hi, [EMAIL PROTECTED] wrote: >I have a text file with a records like: > >smith, James, Dr., 115 Fourth Street, Chicago, IL, 32012, $20.00: >[EMAIL PROTECTED] > >and another text file with placeholders like: > >Hello $last_name, $first_name: > >I want to read the first textfile and update the seco

Re: all matches of a regex

2004-02-15 Thread Jan Eden
Öznur Taþtan wrote: >Hi, >I have been trying to solve a problem which is about to drive me crazy. >May be some one know the answer(hopefully:) > >I want to get all macthes of a pattern in a string including the overlaping >ones. >For example >the string is "xHxxHyyKzDt" >and the pattern is /^(

Re: Local Scope Variables

2004-02-14 Thread Jan Eden
Wiggins d'Anconia wrote: >sub test1 { > my $aa = 1; > my $aaa = 2; > test2($aa, $aaa); >} > >sub test2 { > my ($bb, $bbb) = @_; > print "aa = $bb\n"; > print "aaa = $bbb\n"; >} > >Is the above better, in the court of readability and encapsulation, >yes, in the court of elegance, maybe

RE: basic explanation on code

2004-02-14 Thread Jan Eden
Ronen Kfir wrote: >If I get you correctly the %supliers hash will look like this in this >script: >%supliers =(booboo =>'1', > Puter =>'1', > Synta => 'defined') > or am I wrong. I need to see the real print of this hash in order to >understand it... > Not exactly, all ke

RE: basic explanation on code

2004-02-13 Thread Jan Eden
Hi, Ronen Kfir wrote: >Hi Jan, >I am sorry... > >This is the right code: > > >#!/usr/bin/perl > >%machines =(user1, 'booboo', >user2, 'puter', > user3, 'synta', >user4, 'synta'); > > for (keys %machines) > { >$val=$machines{$_}; > if (!defined $supliers{$va

Re: basic explanation on code

2004-02-13 Thread Jan Eden
Hi, Ronen Kfir wrote: >#!/usr/bin/perl > > >%machines =(user1, 'booboo', >user2, 'puter', > user3, 'synta', > user4, 'synta'); > > for $key (keys %machines) > { >$val=$programs{$key} >if (!defined $supliers{$val}) >{ >$supliers{$va

Data::Dumper trouble

2004-02-12 Thread Jan Eden
Hi all, I want to store some complex data. My first solution made use of Storable, which worked just fine. Now I learned that neither Storable nor MLDBM are available on the machine I want to use the program on (and they cannot be made available). So I retreat to the core and use Data::Dumper t

Re: Email text encoding

2004-02-11 Thread Jan Eden
Wiggins d Anconia wrote: >>Hi, >> >>and thanks for all the previous suggestions regarding email modules. >Now it turned out that my ISP refuses to let me install *any* >additional Perl module on the server, so I have to use sendmail. >> > >Switch ISPs? Sorry this isn't the answer you want. Sorr

RE: Email text encoding

2004-02-11 Thread Jan Eden
Hi Thomas, Thomas Bätzler wrote: >Hi, > >Jan Eden <[EMAIL PROTECTED]> wrote: >> and thanks for all the previous suggestions regarding email >> modules. Now it turned out that my ISP refuses to let me >> install *any* additional Perl module on the server, so I

Re: Array containment

2004-02-11 Thread Jan Eden
James Edward Gray II wrote: >> Now it might be hard to determine which of these two is faster. >And the results, from my G5: > >Benchmark: timing 300 iterations of all_ones, foreach, hash_slice, >map_hash, map_ones, range... > all_ones: 1 wallclock secs ( 1.76 usr + 0.00 sys = 1.76 CPU

Re: Check names of variables

2004-02-11 Thread Jan Eden
Benjamin Walkenhorst wrote: >Hello everybody, > >I've written a perl-module that stores some settings in a DBM-hash. >Currently, the module checks if certain keys have defined values in the >hash and if so, it copies the values belonging to those keys to the >corresponding variables. >These vari

Re: Array containment

2004-02-10 Thread Jan Eden
Rob, James, James Edward Gray II wrote: >On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: >> Rob, I read the perlfaq paragraph you mentioned and found that it >> proposes a solution which does not make use of 'exists': > >What's wrong with exists()? I like exis

Re: Array containment

2004-02-10 Thread Jan Eden
James, Rob, Japhy, I am impressed, really. Thank you! Rob, I read the perlfaq paragraph you mentioned and found that it proposes a solution which does not make use of 'exists': @blues = qw/azure cerulean teal turquoise lapis-lazuli/; %is_blue = (); for (@blues) { $is_blue{$_} = 1 } Now, I had

  1   2   >