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: [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

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: 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

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: 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: 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: 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: 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: 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

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: 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

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-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-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: 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: 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: 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: 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: 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: 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

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/

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

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

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-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: 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: 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: 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: 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 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: 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: 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: 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: __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: 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

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: 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.

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: 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: 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

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: 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

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: 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

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

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

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: >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

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 &

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: 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

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: 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 >>

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

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: 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'; > >

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: 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 >

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: 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

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: 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

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: 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} = 

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: 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 >

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: 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

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
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
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: 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

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: 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

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: 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

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):

Converting using a hash

2003-12-16 Thread Jan Eden
Hi, sorry for the lengthy post. I recently wrote a Perl script to convert 8-bit characters to LaTeX commands. The first version (which works just fine) looks like this (the ... indicates more lines to follow): >#!/usr/bin/perl -pw > >s/â/{\\glqq}/g; >s/â/{\\grqq}/g; >s/Ã/\\'{a}/g; >s/Ã/\\`{a}/

Re: Converting using a hash

2003-12-17 Thread Jan Eden
Hi all, thanks a lot for all the responses. Jeff's explanation of the snippet I mentioned in my original message did the trick. The hash-based solution is much faster now, although the first attempt (using multiple replacements on standard input) is still the fastest. To answer John's question

Re: Compare two array's

2004-01-07 Thread Jan Eden
Maybe the missing opening bracket on the third line? >$a2[$p] = undef if $a1[$j] == $a2[$p]; Being a beginner myself, I cannot recommend a better way. - Jan Jerry Preston wrote: >Hi!, > >I know that this is a no brainer, but I cannot not get it! I want to >compare two arrays and delete the s

Clumsy choice

2004-01-08 Thread Jan Eden
x27;, 3 => 'breskens', ); my %site_hash = ( janeden => "/Users/jan/Sites/jan-eden", gargnano=> "/Users/jan/Sites/gargnano", breskens=> "/Users/jan/Sites/breskens", ); print "\nPlease choose a site!\n\n";

RE: putting $1 into a var

2004-01-08 Thread Jan Eden
Dan Muey wrote: >> Thanks to everyone who helped me with this one, I had a >> deadline to meet that is now met. >> >> It was a missing ~ and me failing to use s on the end of my pattern >> >> may be of use to other users but for some reason my Linux >> server needs s///s; to match over newlin

Writing style

2004-01-09 Thread Jan Eden
Hi, this is not so much a technical as a stilistic question: How do you indent here-quoted parts? When writing code like this: foreach $letter ('a'..'z') { my $upletter = uc $letter; print ALPHAINDEX <<"EOF"; $upletter   EOF

Re: Writing style

2004-01-09 Thread Jan Eden
Rob Dixon wrote: >Jan Eden wrote: >>this is not so much a technical as a stilistic question: How do you >>indent here-quoted parts? When writing code like this: snip >>The tabs get printed into the filehandle ALPHAINDEX. But not >>indenting the here-quoted part mak

Re: Writing style

2004-01-09 Thread Jan Eden
t;. Besides, my HERE documents do work, they just look ugly. ;-) Thanks for the suggestion, I will try to get perlfaq from somewhere. - Jan Jenda Krynicky wrote: >From: Jan Eden <[EMAIL PROTECTED]> >> this is not so much a technical as a stilistic question: How do you >

Re: Writing style

2004-01-09 Thread Jan Eden
Wiggins d Anconia wrote: >Don't use here-docs ;-)... I know, a lame cop out, but they are >probably one of the features of Perl I dislike the most. > >http://danconia.org > I guess you're right... ;-) my $var = qq{'qq' will rule from now on} ; print $var; -- There are two major products that c

Equivalent to iconv for encoding conversion

2004-01-09 Thread Jan Eden
Hi, is there a Perl equivalent to the UNIX program iconv (to convert text from some encoding to another)? Maybe even in the standard distribution? I know I could do a system call to let iconv do the job, but I would like to have a fast program. Thanks, Jan -- The day Microsoft makes somethin

Perl modules on Mac OS X

2004-01-13 Thread Jan Eden
Hi fellows, I have a funny problem: When installing my OS (Mac OS 10.3), I did not realize that the 'make' utility was part of the developer tools (which I did not install). Now neither the CPAN module nor the manual installation process for Perl modules work on my system - due to the missing '

Problems with Text::Iconv

2004-01-13 Thread Jan Eden
Hi, I just managed two install my first two modules, among them Text::Iconv. Now while the iconv utility works fine on my system, the module complains: dyld: perl Undefined symbols: /Library/Perl/5.8.1/darwin-thread-multi-2level/auto/Text/Iconv/Iconv.bundle undefined reference to _libiconv expe

Re: Problems with Text::Iconv

2004-01-13 Thread Jan Eden
James Edward Gray II wrote: >Since you mentioned earlier that you forgot to install the developer >tools, let me just mention that I've ran into problems building things >without them, because of missing header files and the like. I'm not >saying that's your problem, I'm just sharing inform

Re: Oreilly's "Learning Perl 3rd Edition"

2004-01-13 Thread Jan Eden
Randal L. Schwartz wrote: >> "Wiggins" == Wiggins D Anconia <[EMAIL PROTECTED]> writes: > >Wiggins> The two above overlap a good deal. > >The Alpaca and the Panther overlap in that they cover some similar >ground. But the Alpaca is designed to be a step-by-step tutorial: in >fact, it's a tr

Re: redirect with cgi.pm

2004-01-14 Thread Jan Eden
Hi, like this: #!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); my $q = new CGI; print $q->header # do this - do that, using $q print $q->redirect("/thanks.html"); - Jan jdavis wrote: >Hello, > I have been able to use redirects with cgi.pm as long >as the redirec

RE: redirect with cgi.pm

2004-01-14 Thread Jan Eden
>>print $q->header # do this - do that, using $q >> >>print $q->redirect("/thanks.html"); > >redirect() does a header like header(), the first header that gets >sent is the header, the rest is content, even if The contetn looks >just like a header. Thanks for the correction, I have not found the t

Re: == eq > gt

2004-01-14 Thread Jan Eden
Because the following has different return values: beta > alpha (is false) beta gt alpha (is true) alpha eq alpha (is true) alpha == alpha (is ... I don't know, undef maybe?) For || and or, they have different precedence rankings (so you have to adjust your bracketing when exchanging them). -

Re: JPG FILE DOUBTS

2004-01-16 Thread Jan Eden
John McKown wrote: >On Thu, 15 Jan 2004, Andre Chaves Mascarenhas wrote: > >> Hello i wanna know what Perl module can I use and what commands to do the >folowing: >> 1-Check to see if the file is a valid jpg file > >You didn't say what OS. If you're running Linux (or almost any UNIX based >syst

Re: JPG FILE DOUBTS

2004-01-16 Thread Jan Eden
Jan Eden wrote: > >John McKown wrote: > >>On Thu, 15 Jan 2004, Andre Chaves Mascarenhas wrote: >> >>> Hello i wanna know what Perl module can I use and what commands to do the >>folowing: >>> 1-Check to see if the file is a valid jpg file >> &g

Relative path

2004-01-19 Thread Jan Eden
Hi, I wrote some scripts using File::Find's find function like this find (\&process, $path) I get $path either from the command line or from a default string. Now how can I enable my scripts to deal with relative pathnames? Right now, the script complains not being able to process (open etc.)

Re: Relative path

2004-01-19 Thread Jan Eden
James Edward Gray II wrote: >On Jan 19, 2004, at 6:31 AM, Jan Eden wrote: > >>Hi, >> >>I wrote some scripts using File::Find's find function like this >> >>find (\&process, $path) >> >>I get $path either from the command line or from a

  1   2   >