[23586] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5793 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 13 14:05:56 2003

Date: Thu, 13 Nov 2003 11:05:18 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 13 Nov 2003     Volume: 10 Number: 5793

Today's topics:
        "DBI->connect() failed: ERROR OCIEnvInit" (Ed_Zep)
    Re: "DBI->connect() failed: ERROR OCIEnvInit" <usenet@morrow.me.uk>
    Re: "tree" view of directory <bik.mido@tiscalinet.it>
        Best Way to Check Uniqueness in Array <kaspREMOVE_CAPS@epatra.com>
    Re: Best Way to Check Uniqueness in Array <jurgenex@hotmail.com>
    Re: Best Way to Check Uniqueness in Array <ak+usenet@freeshell.org>
    Re: Best Way to Check Uniqueness in Array (Anno Siegel)
    Re: Best Way to Check Uniqueness in Array <kaspREMOVE_CAPS@epatra.com>
    Re: Best Way to Check Uniqueness in Array <ak+usenet@freeshell.org>
    Re: Bit counting benchmarks Was: count of 1s in a binar <bik.mido@tiscalinet.it>
        CGI - unreloadable page? <roman@sky.lviv.ua>
    Re: CGI - unreloadable page? <noreply@gunnar.cc>
        dotsh.pl replacement <mark.d.tischler@lucent.com>
    Re: dotsh.pl replacement (Greg Bacon)
        Echo '*' chars instead of what's typed (bad_knee)
    Re: Echo '*' chars instead of what's typed <usenet@morrow.me.uk>
    Re: fetchall_arrayref into bind_param_array (Oliver G)
    Re: File Append Issue <karigna_no@verizon.net>
    Re: File Append Issue <kaspREMOVE_CAPS@epatra.com>
    Re: File Append Issue (Tad McClellan)
        Giving back Default@User011011101101.net
    Re: how to erase \r or \015 in win32? <noreply@gunnar.cc>
    Re: installing a perl module <kingsman22004@yahoo.com>
    Re: installing a perl module <usenet@morrow.me.uk>
    Re: installing a perl module <syscjm@gwu.edu>
    Re: last index of array reference <abigail@abigail.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 13 Nov 2003 09:27:02 -0800
From: edward.mcmonagle@ntu.ac.uk (Ed_Zep)
Subject: "DBI->connect() failed: ERROR OCIEnvInit"
Message-Id: <4e489625.0311130927.70c26969@posting.google.com>

Hi.

We've recently upgraded from Oracle 8 to Oracle 9.2.0.4.

The Perl script that we have now fails with:

DBI->connect() failed: ERROR OCIEnvInit at
/u02/app/sct/banner/general/exe/ucas_ftp.pl line 124
Couldn't connect to database.

We're using the following:

DBI-1.12
Data-Dumper-2.101  
perl5.005_03      
DBD-Oracle-1.02    
DBI-1.32           
libnet-1.0606

Any ideas as to what I need to do?

Thanks.

Ed.


------------------------------

Date: Thu, 13 Nov 2003 18:55:16 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: "DBI->connect() failed: ERROR OCIEnvInit"
Message-Id: <bp0k2k$a1k$2@wisteria.csv.warwick.ac.uk>


edward.mcmonagle@ntu.ac.uk (Ed_Zep) wrote:
> We've recently upgraded from Oracle 8 to Oracle 9.2.0.4.
> 
> The Perl script that we have now fails with:
<snip>

> Any ideas as to what I need to do?

Just an idea: have you rebuilt DBD::Oracle since you upgraded?

Ben

-- 
  The cosmos, at best, is like a rubbish heap scattered at random.
                                                         - Heraclitus
  ben@morrow.me.uk


------------------------------

Date: Thu, 13 Nov 2003 19:13:23 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: "tree" view of directory
Message-Id: <nog7rvo63p6jm9astdir8nfodbo395g8em@4ax.com>

On Wed, 12 Nov 2003 16:26:02 GMT, "Jeff Thies" <nospam@nospam.net>
wrote:

>  I'd like to have a tree like listing of a directories contents and it's
>subdirectories. I'd like to do that with the modules from the standard perl
>distribution.
>
>  It doesn't appear that I can do that with File::Find. I'm also unsure of
>how to sort a readdir so that it lists directories first.

Surely you're already been given good advice. As for the second point,
I just don't see how File::Find could fail to "do that". In particular
to list directories first (read 'perldoc File::Find' and) try
something like the following:

  # [untested]
  preprocess => sub {
      sort {
  	-d $b <=> -d $a or
  	  $a cmp $b
      } @_;
  }


Michele
-- 
# This prints: Just another Perl hacker,
seek DATA,15,0 and  print   q... <DATA>;
__END__


------------------------------

Date: Thu, 13 Nov 2003 20:41:26 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Best Way to Check Uniqueness in Array
Message-Id: <bp06v3$1ii9gm$1@ID-191136.news.uni-berlin.de>

Hello,

Consider an unsorted array
    my @array = ( 2, 4, 6, 4, 2, 6, A, B, C, C, B, A);

Now, I wish to remove the duplicate elements from this array. A good way may
be to assign these array's elements as keys of a hash. And then convert the
keys back to the array like this:
<UNTEST CODE>

    my @array = ( 2, 4, 6, 4, 2, 6, A, B, C, C, B, A);
    my %hash = ();
    for($i=0;$i<=$#array;$i++){
             $hash{ $array[$i] } = '';
    }

    (@array) = (keys %hash);    # @array now contains unique elements
</UNTEST CODE>

Is there a better or shorter way?

Thanks.
-- 





------------------------------

Date: Thu, 13 Nov 2003 15:16:32 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Best Way to Check Uniqueness in Array
Message-Id: <kfNsb.37315$n6.31929@nwrddc03.gnilink.net>

Kasp wrote:
> Consider an unsorted array
>     my @array = ( 2, 4, 6, 4, 2, 6, A, B, C, C, B, A);
>
> Now, I wish to remove the duplicate elements from this array.

This has been discussed a few times before, please see "perldoc -q
duplicate" or http://www.badtz.org/pics/bart.gif

jue




------------------------------

Date: Thu, 13 Nov 2003 15:21:15 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: Best Way to Check Uniqueness in Array
Message-Id: <slrnbr78b4.dh0.ak+usenet@otaku.freeshell.org>

In article <bp06v3$1ii9gm$1@ID-191136.news.uni-berlin.de>, Kasp wrote:
> Hello,
> 
> Consider an unsorted array
>     my @array = ( 2, 4, 6, 4, 2, 6, A, B, C, C, B, A);
> 
> Now, I wish to remove the duplicate elements from this array. A good way may
> be to assign these array's elements as keys of a hash. And then convert the
> keys back to the array like this:
><UNTEST CODE>
[cut]

my @array = qw( 2 4 6 4 2 6 A B C C B A );
my %hash;

@hash{@array} = 1;
@array = keys %hash;


-- 
Andreas Kähäri


------------------------------

Date: 13 Nov 2003 15:33:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Best Way to Check Uniqueness in Array
Message-Id: <bp0886$2sl$2@mamenchi.zrz.TU-Berlin.DE>

Andreas Kahari  <ak+usenet@freeshell.org> wrote in comp.lang.perl.misc:
> In article <bp06v3$1ii9gm$1@ID-191136.news.uni-berlin.de>, Kasp wrote:
> > Hello,
> > 
> > Consider an unsorted array
> >     my @array = ( 2, 4, 6, 4, 2, 6, A, B, C, C, B, A);
> > 
> > Now, I wish to remove the duplicate elements from this array. A good way may
> > be to assign these array's elements as keys of a hash. And then convert the
> > keys back to the array like this:
> ><UNTEST CODE>
> [cut]
> 
> my @array = qw( 2 4 6 4 2 6 A B C C B A );
> my %hash;
> 
> @hash{@array} = 1;

Why assign 1 to the hash slice, that's neither here nor there.  Either
leave all values undefined:

    @hash{@array} = ();

or set them all to 1:

    @hash{@array} = (1) x @array;

or

   %hash = map { ( $_, 1) } @array;

> @array = keys %hash;

Mind you, your code works, but assigning 1 to one key and leaving the
others undefined makes no sense.

Anno


------------------------------

Date: Thu, 13 Nov 2003 21:08:49 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: Best Way to Check Uniqueness in Array
Message-Id: <bp08ie$1hvare$1@ID-191136.news.uni-berlin.de>

> This has been discussed a few times before, please see "perldoc -q
> duplicate" or http://www.badtz.org/pics/bart.gif

Sorry, didn't do my homework :(
-- 
PS: Nice link!





------------------------------

Date: Thu, 13 Nov 2003 16:06:35 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: Best Way to Check Uniqueness in Array
Message-Id: <slrnbr7b04.dh0.ak+usenet@otaku.freeshell.org>

In article <bp0886$2sl$2@mamenchi.zrz.TU-Berlin.DE>, Anno Siegel wrote:
> Andreas Kahari  <ak+usenet@freeshell.org> wrote in comp.lang.perl.misc:
[cut]
>> @hash{@array} = 1;
> 
> Why assign 1 to the hash slice, that's neither here nor there.  Either
> leave all values undefined:
> 
>     @hash{@array} = ();


Yes, that makes more sense.


-- 
Andreas Kähäri


------------------------------

Date: Thu, 13 Nov 2003 19:13:24 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Bit counting benchmarks Was: count of 1s in a binary number
Message-Id: <q6h7rv8naabuvhm1aabihoo9julb5tjfjs@4ax.com>

On 12 Nov 2003 17:13:07 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>> I'll do some benchmarks when I get a minute.  I'm curious how it compares
>> with a lookup table.
>
>Okay, here are the promised benchmarks.

BTW: the thread from which this one originated and this one are
jointly one of the best discussions I've read (and took part to)
recently here on clpm. It may constitute the basis of a case study for
an exposition or something similar...


Michele
-- 
# This prints: Just another Perl hacker,
seek DATA,15,0 and  print   q... <DATA>;
__END__


------------------------------

Date: Thu, 13 Nov 2003 16:10:29 +0200
From: "Roman Khutkyy" <roman@sky.lviv.ua>
Subject: CGI - unreloadable page?
Message-Id: <bp0339$1c7t$1@news.uar.net>

Hi all.
There is a problem (i hope so). When i submit the form first time, the
script put fields data  into database. But when on next page i make "Reload"
this process repeats again, and the same record are being placed. How to
disallow this. I mean, how to make the new page withot any parameter in
address string?




------------------------------

Date: Thu, 13 Nov 2003 17:10:12 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI - unreloadable page?
Message-Id: <bp0alo$1jb9k5$1@ID-184292.news.uni-berlin.de>

Roman Khutkyy wrote:
> When i submit the form first time, the script put fields data  into
> database. But when on next page i make "Reload" this process
> repeats again, and the same record are being placed. How to
> disallow this. I mean, how to make the new page withot any
> parameter in address string?

Note that this is not a Perl language question, so you are not at the
right place.

Anyway, if the parameters appear in the address bar, the form was
submitted using the GET method. To avoid that, you can use the POST
method.

That does not prevent the data to be resubmitted if you make a
"Reload", but I believe that browsers typically ask before
resubmitting form data.

HTH

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Thu, 13 Nov 2003 10:40:18 -0600
From: "Mark D. Tischler" <mark.d.tischler@lucent.com>
Subject: dotsh.pl replacement
Message-Id: <3FB3B3F2.5090108@lucent.com>

In a quick search in this newsgroup, I see no discussion 
concerning dotsh.pl, so I'm hoping that this hasn't been 
previously discussed.  If so, my apologies.

The header in the 5.6.1 version of dotsh.pl says that it isn't 
being maintained any longer.  Is there a replacement for it? 
The reason I'm asking is because we have discovered that when 
using it, it puts single quotes around the value for a 
variable, which is undesirable, especially to Java.  So, if I 
execute:
	&dotsh("file");
where "file" has a series of variable=value lines, including, e.g.:
	VAR=val
and, if I then do:
	print "VAR=$VAR\n";
in my Perl script, I get:
	VAR='val'
whereas I would have expected:
	VAR=val
Thanks for any assistance anyone can provide in either getting 
around this problem or using a new and improved version or 
equivalent of dotsh.

Mark Tischler
mtischler@lucent.com



------------------------------

Date: Thu, 13 Nov 2003 17:33:41 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: dotsh.pl replacement
Message-Id: <vr7g3lrvovpdd0@corp.supernews.com>

In article <3FB3B3F2.5090108@lucent.com>,
    Mark D. Tischler <mark.d.tischler@lucent.com> wrote:

: [...]
: Thanks for any assistance anyone can provide in either getting 
: around this problem or using a new and improved version or 
: equivalent of dotsh.

Abigail has posted the following trick:

    # Filename shouldn't have single quotes in it.
    my $ENVIRONMENT = "/some/file/with/environment/variables/";

    if (@ARGV && $ARGV [0] eq '--sourced_environment') {
        shift;
    }
    else {
        if (-f $ENVIRONMENT) {
            #
            # Now we perform a double exec. The first exec gives us a shell,
            # allowing us the source the file with the environment variables.
            # Then, from within the shell we re-exec ourself - but with an
            # argument that will prevent us from going into infinite recursion.
            #
            # We cannot do a 'system "source $ENVIRONMENT"', because
            # environment variables are not propagated to the parent.
            #
            # Note the required trickery to do the appropriate shell quoting
            # when passing @ARGV back to ourselves.
            #
            # Also note that the program shouldn't normally be called with
            # '--sourced_environment' - if so, pick something else.
            #

            @ARGV = map {s/'/'"'"'/g; "'$_'"} @ARGV;

            exec << "        --";
                source '$ENVIRONMENT'
                exec    $0  --sourced_environment @ARGV;
            --
            die  "This should never happen.";
        }
    }

NB: zap the leading four spaces on the code above so the compiler can
find the here-document terminator.  It'd be sweet if Perl 6 would
provide a way to work around these concerns of typography.

Hope this helps,
Greg
-- 
The best way to understand this whole issue is to look at what the
government does: it takes money from some people, keeps a bunch of it,
and gives the rest to other people.
    -- Dave Barry


------------------------------

Date: 13 Nov 2003 10:43:17 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: Echo '*' chars instead of what's typed
Message-Id: <e817ca4d.0311131043.1d2c0f43@posting.google.com>

Hello,
I'm getting password input from the user in a perl script,
and was wondering if anyone knows how to echo splats at them 
instead of not showing any chars at all? (eg: stty -echo)

Thanks


------------------------------

Date: Thu, 13 Nov 2003 19:02:34 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Echo '*' chars instead of what's typed
Message-Id: <bp0kga$a1k$4@wisteria.csv.warwick.ac.uk>


bl8n8r@yahoo.com (bad_knee) wrote:
> Hello,
> I'm getting password input from the user in a perl script,
> and was wondering if anyone knows how to echo splats at them 
> instead of not showing any chars at all? (eg: stty -echo)

perldoc -q password

Ben

-- 
               EAT
               KIDS                                          (...er, whoops...)
               FOR                                             ben@morrow.me.uk
               99p


------------------------------

Date: 13 Nov 2003 06:59:31 -0800
From: oliver.gassner@web.de (Oliver G)
Subject: Re: fetchall_arrayref into bind_param_array
Message-Id: <eabb4cb1.0311130659.388dd246@posting.google.com>

James Willmore <jwillmore@remove.adelphia.net> wrote in message news:<20031113063623.4a7323ad.jwillmore@remove.adelphia.net>...
> On 12 Nov 2003 23:07:17 -0800
> Some may not think this is an efficent way to do this, but I do it
> because it's more readable.  Plus, the results of the query will not
> return properly if the schema of the data source changes - which will
> signal a change to the script.
> 
> Try (untested):
> ------------------------------------------------------------
> $DW_dbh = 
>     DBI->connect(
>         "dbi:ODBC:TestIHLE", "TEST2", "TEST2",
>         {RaiseError=>1}
>     )
>        or die "$DBI::errstr\n";
> 
> $hSel = $DW_dbh-> prepare ("select * from temptab");
> 
> #are you *sure* you want to select from temptab and then,
> #insert the results into temptab - the *same* place the 
> #select results came from?
> $hHosttab = 
>     $DW_dbh-> prepare ("insert into temptab values (?,?,?)");
> 
> $hSel->execute();
> 
> #change the *_column_name" to the name of
> #each column - for example:
> #if the first column is "dog", then 
> #"$ref->{first_colum_name}" should read
> #"$ref->{dog}"
> while(my $ref = $fetchrow_hashref){
>     $hHosttab->execute(
>         "$ref->{first_colum_name}", 
>         "$ref->{second_column_name}", 
>         "$ref->{third_column_name",
>         {ArrayTupleStatus => \my @tuple_status }
>     );
> }
> ------------------------------------------------------------
> 
> Notice that I coded for hash references versus array references.  For
> me, I prefer to use hash references, because I should *know* the
> database schema - especially if I'm going to do inserts with the data
> latter on.  I'm not saying it's more efficent or that you can't use
> array refererences - I do it because I can read easily what's going on
> with the code.
> 
> You should consider changing the table name for the insert statement
> you posted - unless you *like* infinite loops :-)
> 
> HTH and does what you want it to do.
> 
> -- 
> Jim
> 
> Copyright notice: all code written by the author in this post is
>  released under the GPL. http://www.gnu.org/licenses/gpl.txt 
> for more information.
> 
> a fortune quote ...
> "Dying is a very dull, dreary affair.  And my advice to you is to
> have nothing whatever to do with it."   -- W. Somerset Maugham

Thank you Jim but it doesn't what i wanna do.
I am searching for the fastest way to transfer data between 2
Databases. So i wanna do a Batchinsert with 100 or more Rows per call!

Any other Idea how to Transfer Data fastest via Perl between DB2 and
SqlServer?

Greetings 
Olli


------------------------------

Date: Thu, 13 Nov 2003 14:30:23 GMT
From: "Anand" <karigna_no@verizon.net>
Subject: Re: File Append Issue
Message-Id: <3AMsb.19601$hB5.15451@nwrdny02.gnilink.net>


"Kasp" <kaspREMOVE_CAPS@epatra.com> wrote in message
news:bp02se$1j6der$1@ID-191136.news.uni-berlin.de...
> "Anand" <karigna_no@verizon.net> wrote in message
> news:f1Msb.33513$y95.5307@nwrdny01.gnilink.net...
> > The commented and uncommented sections do the same thing though, they
> create
> > a second file without the .html extender rather than appending to
> > test1.html. What am I doing wrong here?
>
> Try specifying the absolute path to the file test1.html
>
> Also remember to "close" the file once you are done working with it.
>
> Add the following two lines to your code at the top:
>     use strict;
>     use warnings;
>
Kasp,

I made the changes recommended but the line indicated below errors with the
following:
print() on closed filehandle DAT at F:\Perl_Work\fileappend.pl line 15.

I presume that it sees the file as being closed when attempting to append
and thus writes a new file but why?

my $line_to_write="I've appended a line to a file !";
my $file_name="c:\test1.html";

open DAT,">>$file_name";

print DAT "$line_to_write\n"; #this line errors

close DAT;

A.




------------------------------

Date: Thu, 13 Nov 2003 20:31:04 +0530
From: "Kasp" <kaspREMOVE_CAPS@epatra.com>
Subject: Re: File Append Issue
Message-Id: <bp06cl$1i4hla$1@ID-191136.news.uni-berlin.de>

Problem was with the way $file_name is defined. A \ in double quotes gets
interpolated.
The "c:\test.htm" is tansformed to "c:<TAB>est.htm" .... so just use /
instead of \ for file names, paths etc.

Here is the code that worked for me:

use strict;
use warnings;

my $line_to_write="I've appended a line to a file !";
my $file_name="c:/test1.html"; # Used / instead of \ .... \t means TAB

open DAT,">>$file_name";

print DAT "$line_to_write\n";  #this line errors

close DAT;





------------------------------

Date: Thu, 13 Nov 2003 09:24:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: File Append Issue
Message-Id: <slrnbr78hj.lec.tadmc@magna.augustmail.com>

Anand <karigna_no@verizon.net> wrote:

> open DAT,">>$file_name";


You should always, yes *always*, check the return value from open():

   open DAT,">>$file_name" or die "could not open '$file_name'  $!";


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 13 Nov 2003 18:36:12 GMT
From: Default@User011011101101.net
Subject: Giving back
Message-Id: <waQsb.19848$hB5.14448@nwrdny02.gnilink.net>

Hi, I'm totally new to programming and ive been reading the ng for a week or so now.
The things ive read in here have been very helpfull.

I just finished this little program that fixes letter case, im not sure if its bulletproof yet.
Anyhow it was kind of a pain as I've never delt with RegEx before, so if this is usefull to anyone
please by all means have it.

If there are errors please let me know.  Thanks everybody you all are very cool.

#!
use strict;
use warnings;
print "\n" . " " . "="x78 . "\n";
print " Reads a text file and capitalizes the first letter of each sentence.\n\n";
print "\tUSAGE:\t perl 15_1.plx <inputfile> <outputfile> [options]\n";
print "\tNOTE:\t wildcards are not allowed.\n";
print "\tOPTIONS: -l  Lowercases everything before doing the capitalization.\n";
print "\t\t -d  Display work being done on screen.\n";
print "\n\tEXAMPLE: perl 15_1.plx fixcase.txt casefixed.txt\n";
print " " . "="x78 . "\n\n";
our $lines = "";
our $options1 = "";
our $options2 = "";
our $inputfile = shift || die "\n";
our $outputfile = shift || die "\n";
$options1 = shift || $options1 eq "";
$options2 = shift || $options2 eq "";
$options1 =~ tr/A-Z/a-z/;
$options2 =~ tr/A-Z/a-z/;
open_files($inputfile, $outputfile);
while (our $line = <INPUT>)
{
	$lines = "$lines $line";
}
print "$lines\n\n" if ($options1 eq "-d" || $options2 eq "-d");
$lines =~ s/(\w+)/\L$1/g if ($options1 eq "-l" || $options2 eq "-l");
print "$lines\n\n" if ($options1 eq "-d" || $options2 eq "-d");
$lines =~ s/(\w)/\u$1/;
print "$lines\n\n" if ($options1 eq "-d" || $options2 eq "-d");
$lines =~ s/([\.\?\!]+\s+)(\w+)/$1\u\L$2/g;
print "$lines\n\n" if ($options1 eq "-d" || $options2 eq "-d");
print OUTPUT $lines;
print "\nDone.\n";
close (INPUT) || die "Can't close $inputfile $!\n";
close (OUTPUT) || die "Cant't close $outputfile $!\n";
#Subroutines#
sub open_files
{
open(INPUT, $inputfile) || die "\nError:\nCould not open $inputfile $!\n";
if (-e $outputfile)
{
	die "\nError:\nFile already exists.\t$outputfile\n";
}
else
{
	open(OUTPUT,">$outputfile") || die "Could not create $outputfile $!\n";
}
}


------------------------------

Date: Thu, 13 Nov 2003 16:40:13 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: how to erase \r or \015 in win32?
Message-Id: <bp08tf$1j4pgr$1@ID-184292.news.uni-berlin.de>

the zorg wrote:
> Gunnar Hjalmarsson wrote:
>> news.hinet.net wrote:
>>> i want to erase ^M in then end of lines. but i can do this in
>>> win32.
>>> 
>>> $_=~s/\r//g;   #but  \r still exist
>> 
>> Not for me.
>> 
>> $_ = "First line\r\nSecond line\r\n";
> 
> yes but have you not just typed a backslash and an 'r' and not the 
> control character "\r"?

No. The string is delimited with double-quotes.

We know very little about OP's actual problem, but I have a feeling 
that David may have hit the nail on the head.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Fri, 14 Nov 2003 03:12:37 +1100
From: King <kingsman22004@yahoo.com>
Subject: Re: installing a perl module
Message-Id: <3FB3AD75.5090306@yahoo.com>

Ben Morrow wrote:
> news@group.com wrote:
> 
>>Hello
>>I installed a Bit::Vector
>>
>>$
>>$ pon <isp>
>>$ /bin/su
>># cd /usr/local/bin
>># perl -MCPAN -e 'install "Bit::Vector"'
> 
> 
> <sigh>
> 
> I thought I explained this.
> 
> Type, as root
> 
>   perl -v
> 
> . The first perl in root's PATH is /usr/bin/perl, not
> /usr/local/bin/perl. You need to make sure you invoke the right perl.

and to make sure, I # cd /usr/local/bin which is the version of perl I 
want to install the module under which is perl-5.8.1, what am I missing?

[qoute] from a previous post
Become root, then
# /usr/local/bin/perl -MCPAN -e'install "Data::Dumper"'

well, I did.
# /bin/su
# cd /usr/local/bin
# perl -MCPAN -e'install "Bit::Vector"'

$ perl -v
This is perl, v5.8.1 built for i686-linux
<snipt>

$ /bin/su
# perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
<snipt>

what is this, I thought it should say v5.6.1 which is the system perl. 
why did it change? oh.. boy



------------------------------

Date: Thu, 13 Nov 2003 16:25:18 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: installing a perl module
Message-Id: <bp0b9e$5qi$1@wisteria.csv.warwick.ac.uk>


news@group.com wrote:
> Ben Morrow wrote:
> > news@group.com wrote:
> > . The first perl in root's PATH is /usr/bin/perl, not
> > /usr/local/bin/perl. You need to make sure you invoke the right perl.
> 
> and to make sure, I # cd /usr/local/bin which is the version of perl I 
> want to install the module under which is perl-5.8.1, what am I
> missing?

That Linux Is Not DOS. The current directory isn't (and shouldn't be,
especially not for root) in your PATH, so if root's PATH has /usr/bin
before /usr/local/bin (which it should) then 'perl' as root will
invoke /usr/bin/perl. 'which perl' will tell you if this is the case.

> [qoute] from a previous post
> Become root, then
> # /usr/local/bin/perl -MCPAN -e'install "Data::Dumper"'
> 
> well, I did.
> # /bin/su
> # cd /usr/local/bin
> # perl -MCPAN -e'install "Bit::Vector"'

I do not see '/usr/local/bin/' in the line above.

> $ perl -v
> This is perl, v5.8.1 built for i686-linux
> <snipt>
> 
> $ /bin/su
> # perl -v
> This is perl, v5.8.0 built for i386-linux-thread-multi
> <snipt>
> 
> what is this, I thought it should say v5.6.1 which is the system perl. 
> why did it change? oh.. boy

As this says 'i386' not 'i686' my guess is this is a Debian copy of
perl... have you updated the perl package? If you have, and everything
hasn't broken :), then I would strongly suggest you get rid of
/usr/local/bin/perl until you know a little more about using Linux.

Ben

-- 
perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
2047502190/'                                                 # ben@morrow.me.uk


------------------------------

Date: Thu, 13 Nov 2003 11:31:12 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: installing a perl module
Message-Id: <3FB3B1D0.8030007@gwu.edu>

King wrote:
> Ben Morrow wrote:
> 
>> news@group.com wrote:
>>
>>> Hello
>>> I installed a Bit::Vector
>>>
>>> $
>>> $ pon <isp>
>>> $ /bin/su
>>> # cd /usr/local/bin
>>> # perl -MCPAN -e 'install "Bit::Vector"'
>>
>>
>>
>> <sigh>
>>
>> I thought I explained this.
>>
>> Type, as root
>>
>>   perl -v
>>
>> . The first perl in root's PATH is /usr/bin/perl, not
>> /usr/local/bin/perl. You need to make sure you invoke the right perl.
> 
> 
> and to make sure, I # cd /usr/local/bin which is the version of perl I 
> want to install the module under which is perl-5.8.1, what am I missing?
> 
> [qoute] from a previous post
> Become root, then
> # /usr/local/bin/perl -MCPAN -e'install "Data::Dumper"'
> 
> well, I did.
> # /bin/su
> # cd /usr/local/bin
> # perl -MCPAN -e'install "Bit::Vector"'

Um, no, that's not the same thing.  root may not have the current
directory in its path.  In fact, it shouldn't, IMHO.  You needed
to say ./perl.

> 
> $ perl -v
> This is perl, v5.8.1 built for i686-linux
> <snipt>
> 
> $ /bin/su
> # perl -v
> This is perl, v5.8.0 built for i386-linux-thread-multi
> <snipt>

Pin-pon.  You installed the package to the wrong perl.

> 
> what is this, I thought it should say v5.6.1 which is the system perl. 
> why did it change? oh.. boy
> 

Can't answer that for you.

               Chris Mattern



------------------------------

Date: 13 Nov 2003 14:10:30 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: last index of array reference
Message-Id: <slrnbr746m.e8j.abigail@alexandra.abigail.nl>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMDCCXXVI
September MCMXCIII in <URL:news:bovtj9$p47$1@mamenchi.zrz.TU-Berlin.DE>:
`'  
`'  Similarly, $#{ @array} "ought to" return the top index of @<n>.  The
`'  actual behavior could be meant to be a case of DWIM, though I doubt it.
`'  It isn't documented, afaik, and it shouldn't be used except for obfuscation.


Abigail
-- 
perl -wle 'eval {die [[qq [Just another Perl Hacker]]]};; print
           ${${${@}}[$#{@{${@}}}]}[$#{${@{${@}}}[$#{@{${@}}}]}]'


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5793
***************************************


home help back first fref pref prev next nref lref last post