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 execute the former. > >Is it true that in Perl, I can create a directory only within the

Re: chdir and mkdir

2005-07-26 Thread John W. Krahn
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? Have you tried the mkpath() function from the File::Path module? perldoc File::Path John -- use Perl; program fulfillment -- To unsubscribe,

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 exists". /some/dir does exist, but newsubdir does not. >Have you tried the mk

Re: chdir and mkdir

2005-07-26 Thread Xavier Noria
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, even if your "mkdir" kernel call won't create more than one level of directory at a time. ' But my sy

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, even if your "mkdir" kernel call won't create more >> t

Re: "=20"

2005-07-26 Thread Tom Allison
Thomas Bätzler wrote: Tom Allison <[EMAIL PROTECTED]> wrote: I find these a lot on email and I know it's some encoding problem somewhere. That's the quoted-printable encoding for MIME mails. Of course you can handle it manually like japhy suggested, but the proper way would be to use MIME::

Re: chdir and mkdir

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

Re: chdir and mkdir

2005-07-26 Thread Randal L. Schwartz
> "Jan" == Jan Eden <[EMAIL PROTECTED]> writes: Jan> chdir "/some/dir"; This might have failed... Jan> mkdir "newsubdir/" or die "$!"; which would make this in the wrong directory. Are you checking that? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http

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"; > >This might have failed... > >Jan> mkdir "newsubdir/" or die "$!"; >

What does "unblessed reference" mean?

2005-07-26 Thread Dave Adams
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 advance, Dave Adams -- To unsubscribe, e-mail: [EMAIL

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: What does "unblessed reference" mean?

2005-07-26 Thread John Doe
Dave Adams am Dienstag, 26. Juli 2005 17.29: > 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. This means

Re: perl newbie question

2005-07-26 Thread Jay Savage
On 7/25/05, FreeFall <[EMAIL PROTECTED]> wrote: > try: > perl -ne '$line=$_;END{print $line}' yourfile > > On Mon, 25 Jul 2005 19:09:50 +0530 > [EMAIL PROTECTED] wrote: > > > > > hi , > > I am a perl newbie. > > Can someone suggest a perl command line snippet that will print the last n >

IF statements and modules - do they mix?

2005-07-26 Thread Dave Adams
Does perl allow you to conditionally include a module? For example: #!/usr/bin/perl -w use strict; my $DEBUG = 0; if (DEBUG) { use diagnostics; } my $filename = "test$$.txt"; open (FH , ">$filename") || die "error: $!"; print (FH "hi"); close (FH); Although this is a simple and silly example

Re: IF statements and modules - do they mix?

2005-07-26 Thread John W. Krahn
Dave Adams wrote: > Does perl allow you to conditionally include a module? > > For example: > > #!/usr/bin/perl -w > use strict; > my $DEBUG = 0; > if (DEBUG) { > use diagnostics; > } > my $filename = "test$$.txt"; > open (FH , ">$filename") || die "error: $!"; > print (FH "hi"); > close (FH)

skip/delete lines with dup keys

2005-07-26 Thread Jim
Hi I have csv file that has data something like this (Header in caps) LOAN_NO,SCORE,BAL 77585,740,452125 77585,741,450256 85669,658,125869 85669,658,122586 Looking for ideas on the best way to skip/delete a line if the LOAN_NO repeat even if other fields ion in the record are not the same (ne

'Use Lib' problem...

2005-07-26 Thread Tony Frasketi
Hello listers I'm trying to use the following 'use lib' statement as described at http://www.unix.org.ua/orelly/perl/prog3/ch31_13.htm use lib "$ENV{HOME}/libperl"; # add ~/libperl In a *test* program, I've written $ENV{HOME} = 'home/tony/cgi-bin'; # My cgi-bin directory

Re: 'Use Lib' problem...

2005-07-26 Thread Tom Allison
Tony Frasketi wrote: Hello listers I'm trying to use the following 'use lib' statement as described at http://www.unix.org.ua/orelly/perl/prog3/ch31_13.htm use lib "$ENV{HOME}/libperl"; # add ~/libperl In a *test* program, I've written $ENV{HOME} = 'home/tony/cgi-bin'; # M

Re: 'Use Lib' problem...

2005-07-26 Thread Jeff 'japhy' Pinyan
On Jul 26, Tony Frasketi said: $ENV{HOME} = 'home/tony/cgi-bin'; # My cgi-bin directory Are you sure there shouldn't be a / at the beginning of that? use lib "$ENV{HOME}/pm"; # Add my personal perl module directory The problem is that 'use lib' happens at compile-time, but y

Re: skip/delete lines with dup keys

2005-07-26 Thread John W. Krahn
Jim wrote: > > Hi Hello, > I have csv file that has data something like this (Header in caps) > > LOAN_NO,SCORE,BAL > 77585,740,452125 > 77585,741,450256 > 85669,658,125869 > 85669,658,122586 > > Looking for ideas on the best way to skip/delete a line if the LOAN_NO > repeat even if other fi

Re: skip/delete lines with dup keys

2005-07-26 Thread Jeff 'japhy' Pinyan
On Jul 26, Jim said: Looking for ideas on the best way to skip/delete a line if the LOAN_NO repeat even if other fields ion in the record are not the same (need to remove lines with dup key fields). The code below seems to work, but there must be a better way. Your code works fine, assuming th

Problem making system call on Win98.. help!

2005-07-26 Thread robert johnson
this is driving me crazy. i worked on it for hours and cant figure it out. i have an execuatable program, written in C, that prints its result as a string to the terminal. and this program definitely works correctly on WinXP or Win98. it prints the result to the screen. big deal, right? when