[24424] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6610 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 26 09:05:54 2004

Date: Wed, 26 May 2004 06:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 26 May 2004     Volume: 10 Number: 6610

Today's topics:
    Re: Am I a programmer or a scripter? <vetro@online.no>
    Re: create directory ... <mgjv@tradingpost.com.au>
        Fetchgals: script to download gigabytes of free porn (Ratta Newatta)
    Re: From one-liner to script: -i option? <usenet@morrow.me.uk>
    Re: From one-liner to script: -i option? <socyl@987jk.com>
    Re: how do I convert a file into its 8 bit 0/1 pattern  <nobull@mail.com>
    Re: How to find the target of a Unix symlink? <Joe.Smith@inwap.com>
        How to remove ^M using perl ?  <matrix_calling@yahoo.dot.com>
    Re: How to remove ^M using perl ? <noreply@gunnar.cc>
    Re: How to remove ^M using perl ? <matrix_calling@yahoo.dot.com>
    Re: How to remove ^M using perl ? <noreply@gunnar.cc>
    Re: How to remove ^M using perl ? <matrix_calling@yahoo.dot.com>
    Re: iterating over arrays with map - problem <Joe.Smith@inwap.com>
    Re: Map or Regex and Sorting <krahnj@acm.org>
    Re: ne not working? <ThomasKratz@REMOVEwebCAPS.de>
        Need Help Protecting Word Doc via Win32::OLE (Tom Welch)
        newbie question <matrix_calling@yahoo.dot.com>
    Re: newbie question (Anno Siegel)
    Re: open file error <emanuele.matli@cern.ch>
    Re: Perl inplace editing <krahnj@acm.org>
    Re: Perl vs PHP <wubo@siemens.com>
    Re: Perl work? (krakle)
    Re: Perl work? <cwilbur@mithril.chromatico.net>
    Re: Perl work? <peter@semantico.com>
        printing all possible permutations of a set of characte <_>
        soap::lite <mail@mail.com>
        Unpack and checksums <obeseted@yahoo.com>
    Re: Unpack and checksums (Anno Siegel)
    Re: Unpack and checksums <fifo@despammed.com>
    Re: Unpack and checksums (Anno Siegel)
    Re: Unpack and checksums <obeseted@yahoo.com>
    Re: Unpack and checksums <fifo@despammed.com>
    Re: Unpack and checksums (Anno Siegel)
    Re: Using Cookies With Perl <jameskorea2003@hotmail.com>
    Re: Using Cookies With Perl <tore@aursand.no>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 26 May 2004 11:20:54 +0200
From: "Vetle Roeim" <vetro@online.no>
Subject: Re: Am I a programmer or a scripter?
Message-Id: <opr8ln84r33hk3cf@quickfix.opera.com>

On Tue, 25 May 2004 12:09:20 GMT, Mothra <mothra@mothra.com> wrote:

[...]
> I encounter some snobbery from time to time with programmers telling me  
> that what I'm doing is "just scripting", whereas the stuff they write  
> (in Java, ColdFusion, C++ etc) is "real programming".

   Programming in Java is no more real than programming in Perl, and anyone
   that claims anything else suffer from the "Perl hack" syndrome.

   Perl suffers from an image problem, and there are people going around
   imagining that Perl cannot be used for 'serious' applications, and that
   anything written in Perl is a hack (in the bad sense). This is simply not
   true.


> Well yes, I'm a lowly Sys Admin, and I've only been using Perl for about  
> 3 years, but I've written some big and complex "scripts" in Perl to  
> solve Sys Admin-type problems.
>
> So is there a real difference, or is it just semantic snobbery?

   Semantic snobbery, no doubt.


-- 
Touch eyeballs to screen for cheap laser surgery!


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

Date: 26 May 2004 06:42:15 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: create directory ...
Message-Id: <slrncb8f26.mhn.mgjv@verbruggen.comdyn.com.au>

On 25 May 2004 18:15:48 -0600,
	Jim Cochrane <jtc@shell.dimensional.com> wrote:
> In article <40b3c041$1@news.wineasy.se>, Rickard wrote:

>> Are there any other command to use to create an directory?

[snippage]

> Creating directories is also quite easy - e.g., system("mkdir $dir"), or
> find the right module.

What's wrong with the builtin function mkdir?

Martien
-- 
                        | 
Martien Verbruggen      | Make it idiot proof and someone will make a
Trading Post Australia  | better idiot.
                        | 


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

Date: 26 May 2004 02:12:15 -0700
From: newatta@yahoo.com (Ratta Newatta)
Subject: Fetchgals: script to download gigabytes of free porn
Message-Id: <c042ae13.0405260112.30f4daf0@posting.google.com>

Fetchgals 5.6 has been released at http://fetchgals.sourceforge.net.
It's a free perl script running on Linux which downloads free porn
from the web by following links from known TGPs.

Enjoy,
  Atta


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

Date: Wed, 26 May 2004 05:54:40 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: From one-liner to script: -i option?
Message-Id: <c91bf0$t7s$1@wisteria.csv.warwick.ac.uk>


Quoth kj <socyl@987jk.com>:
> 
> I want to turn this "one-liner" (broken up for clarity)
> 
>   perl -i.bak -pe '                                   \
>      BEGIN { $T = 8 }                                 \
>      1 while s{^( *)\t}                               \
>               {$1 . (" " x ($T-((length $1)%$T)))}ex' \
>      some_file
> 
> into a script, but leaving the -i option (whether it is used or
> not, and if so, what argument, if any, to give it) entirely up to
> the user.

#!/usr/bin/perl -p

BEGIN {
    if ($ARGV[0] =~ /^-i/) {
        ($^I = shift) =~ s/^-i//;
    }

    $T = 8;
}

1 while ...;

Ben

-- 
        I must not fear. Fear is the mind-killer. I will face my fear and
        I will let it pass through me. When the fear is gone there will be 
        nothing. Only I will remain.
ben@morrow.me.uk                                          Frank Herbert, 'Dune'


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

Date: Wed, 26 May 2004 10:25:46 +0000 (UTC)
From: kj <socyl@987jk.com>
Subject: Re: From one-liner to script: -i option?
Message-Id: <c91rb9$j41$1@reader2.panix.com>

In <c91bf0$t7s$1@wisteria.csv.warwick.ac.uk> Ben Morrow <usenet@morrow.me.uk> writes:

>Quoth kj <socyl@987jk.com>:
>> 
>> I want to turn this "one-liner" (broken up for clarity)
>> 
>>   perl -i.bak -pe '                                   \
>>      BEGIN { $T = 8 }                                 \
>>      1 while s{^( *)\t}                               \
>>               {$1 . (" " x ($T-((length $1)%$T)))}ex' \
>>      some_file
>> 
>> into a script, but leaving the -i option (whether it is used or
>> not, and if so, what argument, if any, to give it) entirely up to
>> the user.

>#!/usr/bin/perl -p

>BEGIN {
>    if ($ARGV[0] =~ /^-i/) {
>        ($^I = shift) =~ s/^-i//;
>    }

>    $T = 8;
>}

>1 while ...;


Thanks!  That's just what I needed.

kj

-- 
NOTE: In my address everything before the period is backwards.


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

Date: 26 May 2004 08:47:13 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: how do I convert a file into its 8 bit 0/1 pattern ?
Message-Id: <u9aczvsgn1.fsf@wcl-l.bham.ac.uk>

jack_posemsky@yahoo.com (Jack) writes:

> Brian McCauley <nobull@mail.com> wrote in message news:<u9iseksbbw.fsf@wcl-l.bham.ac.uk>...
> > jack_posemsky@yahoo.com (Jack) writes:
> > > 
> > > 1- read in a file and store its binary (byte) contents into an array (in increments)
> > > 2- convert the binary bytes into their 8 bit 0/1 equivalents
> > 
> > I do not understand what you mean by this.  On a computer[1] a file
> > consits of bytes and those bytes consist of 8 bits.
> > 
> > Perhaps if you gave an example of the desired input and output?
> 
> I want to capture the exact 0/1 bitstream from a datafile.

That does not clarify matters at all.

I suspect that what you think you are saying here is something more
than what you are actually saying.  Try to take a step back and look
at what you are saying from the point of view of someone else.  For a
scarily similar example of how someone can think they are asking a
perfectly clear question when actually they are not please see:

http://groups.google.com/groups?threadm=bfe227db.0205171818.7facfffa%40posting.google.com

>  How do I accomplish this ?

Well to answer the question you ask (as opposed to the question you
are trying to ask - of which I'm still in the dark)...

open() - to open the file
binmode() - to tell perl to treat the the file as binary data
read() - to read chunks of the file into a scalar variable used as a buffer.

use constant CHUNK => 1024;
my $filename='whatever';
open(my $fh, '<', $filename) or die $!;
binmode($fh);
{
  my $r = read($fh, my $buffer, CHUNK);
  die $! unless defined $r;
  last unless $r;
  # Do stuff with $buffer;
  redo;
} 

Examples like this should be easily found in any Perl tutorial or reference.

Actually in recent Perl open() and binmode() can be combined.  For
details RTFM on open in 5.8.

You can also use readline() (aka the <> operator) rather than read().
For details on putting readline() into fixed size record mode (or
read-the-whole-file (aka "slurp") mode) RTFM on the special variable
$/.  

See also:
   File::Slurp.
   FAQ: "How can I manipulate fixed-record-length files?"
   FAQ: "How can I read in an entire file all at once?"
   perldoc -f open
   perldoc -f binmode
   perldoc -f read
   Posting guidelines for this newsgroup.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 26 May 2004 09:58:57 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: How to find the target of a Unix symlink?
Message-Id: <BTZsc.3681$Ly.315@attbi_s01>

kj wrote:

> Is there a way to get the filename (or filenames) associated with
> a dev+inode combination?

To get an idea as to how difficult that is, read this:
   ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ

	-Joe


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

Date: Wed, 26 May 2004 15:51:49 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: How to remove ^M using perl ? 
Message-Id: <Mj_sc.7$Bk6.41@news.oracle.com>

Hi,

I have a sscript which reads in a set of lines from a windows text file, 
and concatenates it and stores in a string.

I chomp the string after reading it, and do

$_ =~ s/^V<^Enter>//g;  # i.e., I press cntrl -V and then cntrl - Enter

This does not seem to work and I still find ^M charactes when i wtite 
the lines to a file.

What is the way to remove them ?

Thanks
AB



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

Date: Wed, 26 May 2004 13:09:50 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to remove ^M using perl ?
Message-Id: <2hjcbqFdlt2jU1@uni-berlin.de>

Abhinav wrote:
> I have a sscript which reads in a set of lines from a windows text
> file, and concatenates it and stores in a string.
> 
> I chomp the string after reading it, and do
> 
> $_ =~ s/^V<^Enter>//g;  # i.e., I press cntrl -V and then cntrl - Enter
> 
> This does not seem to work and I still find ^M charactes when i
> wtite the lines to a file.
> 
> What is the way to remove them ?

Well, I don't understand the above code, but to remove the Windows CR
characters you can simply try

     tr/\r//d;

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



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

Date: Wed, 26 May 2004 17:23:55 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: Re: How to remove ^M using perl ?
Message-Id: <7G%sc.15$Bk6.67@news.oracle.com>



Gunnar Hjalmarsson wrote:

> Abhinav wrote:
> 
>> I have a sscript which reads in a set of lines from a windows text
>> file, and concatenates it and stores in a string.
>>
>> I chomp the string after reading it, and do
>>
>> $_ =~ s/^V<^Enter>//g;  # i.e., I press cntrl -V and then cntrl - Enter
>>
>> This does not seem to work and I still find ^M charactes when i
>> wtite the lines to a file.
>>
>> What is the way to remove them ?
> 
> 
> Well, I don't understand the above code, but to remove the Windows CR
> characters you can simply try
> 
>     tr/\r//d;
> 
Thanks, but its not working.

What i need to do (and maybe could not explain clearly above) is read a 
file from windoze, and remove all the ^Ms which are visible when I open 
the file in vi ...

doing
:1,$ s/^V^Enter//g
in vi removes them.

tr/\r//d;
when invoked within perl, does not.
neither does s/\r//g;

Thanks
AB



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

Date: Wed, 26 May 2004 13:58:17 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to remove ^M using perl ?
Message-Id: <2hjf6sFdlld4U1@uni-berlin.de>

Abhinav wrote:
> Gunnar Hjalmarsson wrote:
>> to remove the Windows CR characters you can simply try
>> 
>>     tr/\r//d;
> 
> Thanks, but its not working.
> 
> What i need to do (and maybe could not explain clearly above) is
> read a file from windoze, and remove all the ^Ms which are visible
> when I open the file in vi ...
> 
> doing
> :1,$ s/^V^Enter//g
> in vi removes them.
> 
> tr/\r//d;
> when invoked within perl, does not.
> neither does s/\r//g;

In that case, if you want somebody to be able to help you, please post
a short but complete program that illustrates the problem.

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



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

Date: Wed, 26 May 2004 17:37:40 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: Re: How to remove ^M using perl ?
Message-Id: <1T%sc.16$Bk6.87@news.oracle.com>



Abhinav wrote:

> 
> 
> Gunnar Hjalmarsson wrote:
> 
>> Abhinav wrote
[SNIP]
>
>>
>>
>> Well, I don't understand the above code, but to remove the Windows CR
>> characters you can simply try
>>
>>     tr/\r//d;
>>
> Thanks, but its not working.
> 
> What i need to do (and maybe could not explain clearly above) is read a 
> file from windoze, and remove all the ^Ms which are visible when I open 
> the file in vi ...
> 
> doing
> :1,$ s/^V^Enter//g
> in vi removes them.
> 
> tr/\r//d;
This does indeed work :)
apologize for the statement above ..
a coffee break needed !



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

Date: Wed, 26 May 2004 09:35:21 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: iterating over arrays with map - problem
Message-Id: <txZsc.3632$Ly.202@attbi_s01>

Richard Morse wrote:
>          while ($temp =~ s/$sub_let/$sub_matrix{$sub_let}/) {

For 's', that will produce "pa5sword" and "pa55word" but not "pas5word".
	-Joe


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

Date: Wed, 26 May 2004 09:11:23 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Map or Regex and Sorting
Message-Id: <40B45F41.3434636@acm.org>

Uri Guttman wrote:
> 
> >>>>> "JWK" == John W Krahn <krahnj@acm.org> writes:
> 
>   JWK> my ( @openlist, @clsdlist );
> 
>   JWK> push @{ /OPEN/ ? \@openlist : \@clsdlist }, $_ for
>   JWK>     map substr( $_, 3 ),
>   JWK>     sort
>   JWK>     map sprintf( '%03d%s', /(\d{1,3})/, $_ ),
>   JWK>     <DATA>;
> 
>   JWK> print @openlist, @clsdlist;
> 
> i like it, an GRT written on the fly. but you now owe me royalties!

Then you will have to hire me so that I can afford to pay you.  :-)

> for payment, i expect you to test Sort::Maker before its public release.

I couldn't find it on CPAN or your web site.


John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 26 May 2004 13:13:11 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: ne not working?
Message-Id: <40b47d50.0@juno.wiesbaden.netsurf.de>

Matt Garrish wrote:

> "Thomas Kratz" <ThomasKratz@REMOVEwebCAPS.de> wrote in message
> news:40b3931f.0@juno.wiesbaden.netsurf.de...
> 
>>Jay Sun Ex wrote:
>>
>>
>>>#!/usr/local/bin/perl -w
>>>
>>>print "\nPlease enter your name: ";
>>>chomp ($name = <STDIN>);
>>>if ($name ne "me" || $name ne "myself") {
>>>  die "\nYou're not allowed here $name. Bye!\n";
>>>} else {
>>>  print "\nWelcome $name\n";
>>>}
>>
>>In addition to the logic problem others pointed out, it is better to use a
>>lookup hash for this kind of work:
>>
> 
> 
> If you're going to recommend strictures and warnings, your code should
> adhere to them you know... : )

Ooops, forgot to add 'untested' above the code ;-)
I should better run the code I am going to post...

[snipped code and corrections]

Thomas

-- 
open STDIN,"<&DATA";$=+=14;$%=50;while($_=(seek( #J~.> a>n~>>e~.......>r.
STDIN,$:*$=+$,+$%,0),getc)){/\./&&last;/\w| /&&( #.u.t.^..oP..r.>h>a~.e..
print,$_=$~);/~/&&++$:;/\^/&&--$:;/>/&&++$,;/</  #.>s^~h<t< ..~. ...c.^..
&&--$,;$:%=4;$,%=23;$~=$_;++$i==1?++$,:_;}__END__#....>>e>r^..>l^...>k^..


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

Date: 26 May 2004 05:55:53 -0700
From: thomas.e.welch@boeing.com (Tom Welch)
Subject: Need Help Protecting Word Doc via Win32::OLE
Message-Id: <f8c9ba6d.0405260455.42bc58ca@posting.google.com>

Does anyonw know how to apply Word document protection via win32::ole
?  I've been using Win32::OLE to dynamically build a Word document
Form from content in a database.  I've been trying to protect the
document as the last step before saving but so far without success.  I
don't get any errors but the newly saved Word file opens unprotected. 
Here's the code I'm using.

use Win32::OLE qw(in);
my $Word = Win32::OLE->new('Word.Application', 'Quit');
$inFile='test.doc';
$outFile='test_temp.doc';
my $Doc = $Word->Documents->Open($inFile);

 ... misc steps to add form fields ...

# -- protect document
$Doc->Protect({ Type=>wdAllowOnlyFormFields, NoReset=>True,
Password=>"mypw",});

# -- save under new name
unlink $outFile if -f $outFile;
$Doc->SaveAs($outFile);
$Doc->Close;

Thanks,
Tom Welch


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

Date: Wed, 26 May 2004 15:11:03 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: newbie question
Message-Id: <zJZsc.5$Bk6.98@news.oracle.com>

Hi,

I have the following piece of code which checks for a word within <> . 
What I want to do is, if this matches, I want to change the value of a 
variable, which is having an integer value, and whose name is same as 
the matched string, to 1.

Thus, if i match <x>
I need to do
$x = 1 ;

Is there any way i can use the value of the matched text ($1) to create 
the variable name ?

The code is :

if (/<(\w+)>/)
{
# What to put here , so that the corresponding variable gets declared
# and initialized ?
#something like,

my '$'.$1 = 1 ; # I know it is wrong, but just to signify what i want ..
}



Thanks
AB



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

Date: 26 May 2004 10:38:39 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbie question
Message-Id: <c91s3f$46i$2@mamenchi.zrz.TU-Berlin.DE>

Abhinav  <matrix_calling@yahoo.dot.com> wrote in comp.lang.perl.misc:
> Hi,
> 
> I have the following piece of code which checks for a word within <> . 
> What I want to do is, if this matches, I want to change the value of a 
> variable, which is having an integer value, and whose name is same as 
> the matched string, to 1.
> 
> Thus, if i match <x>
> I need to do
> $x = 1 ;
> 
> Is there any way i can use the value of the matched text ($1) to create 
> the variable name ?
> 
> The code is :
> 
> if (/<(\w+)>/)
> {
> # What to put here , so that the corresponding variable gets declared
> # and initialized ?
> #something like,
> 
> my '$'.$1 = 1 ; # I know it is wrong, but just to signify what i want ..
> }

Use a hash for that.  Creating variable names from data outside the
program is a bad idea.  See "perldoc -q 'variable name'" for the
reason.

    my %matched;
    $matched{ $1} = 1 if /<(\w+)>/;

Then use $matched{ a} instead of $a.

Anno


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

Date: Wed, 26 May 2004 09:00:24 +0200
From: Emanuele Matli <emanuele.matli@cern.ch>
Subject: Re: open file error
Message-Id: <c91fa7$hcb$1@sunnews.cern.ch>

Tintin wrote:
> "Emanuele Matli" <emanuele.matli@cern.ch> wrote in message
> news:c8sk83$95r$1@sunnews.cern.ch...
> 
>>Hi all,
>>
>>I have a, probably, stupid problem, but I'm new to perl (not to
>>programming) and I can't see where the problem is.
> 
> 
> It's not specific to Perl, so I'm surprised that you say you have
> programming experience and can't narrow down the issue.

I agree I could have spent some time more to solve the problem by myself...
> 
> 
>>A simple program containing this command:
>>
>>open(FH, "test.txt") || die $!;
>>
>>gives the following answer:
>>
>>"No such file or directory"
> 
> 
> As it will when it can't find the file or directory.
> 
> 
>>The file is there and the permissions on the sever dir are ok.
>>On the other hand, if I try to open a file to write I get a permission
>>error because I don't have the right to write in the same dir.
> 
> 
> The file is somewhere, but it certainly isn't where you run the script on.
> 
> Add
> 
> use Cwd;
> print "My current directory is: " . cwd() . "\n";

Thanks for the help. The cwd() function was exactly what I was looking 
for. I was trying to do the same thing with the url stuffs. 
Unfortunately, since I was running the script from the server, the 
"wwwroot" part of the path was not visible that way.

> 
> That should give you a *big* clue.
> 
> Moral of the story is don't make assumptions about your current dir in a CGI
> environment (which I'm sure this question is about) and use absolute paths
> to make absolutely sure you point to the right location.
Yes, I assumed that if the script and file are in the same dir no 
relative path was necessary.
> 
> 



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

Date: Wed, 26 May 2004 08:50:42 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Perl inplace editing
Message-Id: <40B45A68.661A2FB1@acm.org>

Sundaram Ramasamy wrote:
> 
> "John W. Krahn" <krahnj@acm.org> wrote in message news:<40B2A3D2.64BC6542@acm.org>...
> >
> > perl -i.old -0pe'
> > s/(?<=HOSTNAME)(\s*=\s*.+)/=linux.com/
> > ||
> > s/\z/HOSTNAME=linux.com\n/
> > ' network
> 
> John can you explain the meaning of your script.

The -0p switches open the files on the command line and read the
complete contents of each file into the $_ variable in a while loop and
print the contents of $_ at the end of the loop.  The first substitution
searches for '\s*=\s*.+' which is preceeded by the string 'HOSTNAME'
using a zero-width look-behind assertion.  If it is found it replaces
'\s*=\s*.+' with '=linux.com' and if it is not found it runs the second
substitution which appends "HOSTNAME=linux.com\n" to the end of $_.


John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 26 May 2004 16:52:23 +0800
From: "Berdey" <wubo@siemens.com>
Subject: Re: Perl vs PHP
Message-Id: <c91ls9$m60$1@news.mch.sbs.de>

they are not major in the same funtion.
PHP is used in the web program, but Perl is major in the system
administration.
:)

do you think so?


-- 
kind regards,
berdey
"porter970" <porter970@lycos.com> wrote in message
news:10anbdrachc1u4e@corp.supernews.com...
> Is there a reason to use Perl rather than PHP?  I've got stuff that uses
> both ... so much of the syntax, etc. is similar.  Is one more secure ...
or
> faster ... ?
>
> Steve
>
>




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

Date: 25 May 2004 22:30:37 -0700
From: krakle@visto.com (krakle)
Subject: Re: Perl work?
Message-Id: <237aaff8.0405252130.76c91b29@posting.google.com>

Eric Schwartz <emschwar@pobox.com> wrote in message news:<eto3c5o6onm.fsf@fc.hp.com>...
They're not exactly "taking away our jobs", but they are
> taking jobs that pay less than peanuts to most of us in the First
> World because it's the best they can do.

hmm.. Must be nice to live in one of these backward countries... Live
in tents, 'drive' camels, eat rice oh and work as a Perl programmer on
your personal computer with high speed access from the comfort of your
cozy cave...


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

Date: Wed, 26 May 2004 06:14:13 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Perl work?
Message-Id: <87aczvzpt7.fsf@mithril.chromatico.net>

>>>>> "moron" == krakle  <krakle@visto.com> writes:

    moron> Eric Bohlman <ebohlman@earthlink.net> wrote in message
    moron> news:<Xns94F46CBE74DAebohlmanomsdevcom@130.133.1.4>...
    >> And obversely, an American who was making $2000/year in 1904
    >> could be expected to have a similar background to an American
    >> making $40K/year in 2004.

    moron> Oh yea indeed but you are leaving out one thing.... THIS is
    moron> 2004 NOT 1904. NO there isn't people making $2,000 a year
    moron> today who can afford a morgage, living expenses, computer
    moron> and the education to get the programming knowledge taking
    moron> away your job hah...

There aren't such people *within the borders of the United States,* no.

But there are places in the world -- indeed, the vast majority of the
people in the world live in such places -- where $5000 a year is quite
a respectable income.  And the existence of the global Internet means
that such people, who are thrilled to work for $8 an hour, can sell
their services to American corporations, who are likewise thrilled to
pay someone in China or Africa or India $8 an hour to do something
they'd have to pay someone local $40 an hour to do.

Charlton


-- 
cwilbur at chromatico dot net
cwilbur at mac dot com


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

Date: Wed, 26 May 2004 09:29:40 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: Perl work?
Message-Id: <40b45576$0$2285$afc38c87@news.easynet.co.uk>

krakle wrote:
> hmm.. Must be nice to live in one of these backward countries... Live
> in tents, 'drive' camels, eat rice oh and work as a Perl programmer on
> your personal computer with high speed access from the comfort of your
> cozy cave...

Your ignorance and racism are unbounded, just a few facts to set you straight:

1) A tent is not a cave. 'Live in tents' and 'your cozy cave'
2) Rice is not grown where camels live
3) Not all Internet access is high speed

Sounds like you come from a backward country yourself given your level of education.


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

Date: Wed, 26 May 2004 20:00:44 +1000
From: "OL/2" <_>
Subject: printing all possible permutations of a set of characters
Message-Id: <40b46ac6$0$3035$afc38c87@news.optusnet.com.au>

Hi everyone. By counting up from 0, it is possible to print all permutations
of an n-digit number, but what if I want to include certain characters in
that range? How can I print all n-length permutations of an arbitrary set of
characters?

cheers




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

Date: Wed, 26 May 2004 12:37:14 +0100
From: "bob" <mail@mail.com>
Subject: soap::lite
Message-Id: <Qt-cnaEpGumXHyndSa8jmA@karoo.co.uk>

Hi,
I have searched all the news groups etc.. for an answer to this so thought
someone may be able to help here. Basically we have a soap server written in
gsoap and im having to send a very large piece of xml too it.
The problem is that gsoap types all the objects  and expects them in a
certain format.
i.e.

<Runner name="Jimmy Ryan" yearBorn="20010329" age="2" bred="IRE"
xsl:type="Runner:Runner">
rather than

<Runner name="Jimmy Ryan" yearBorn="20010329" age="2" bred="IRE">
We have a wsdl file specifying this but soap::lite doesnt seem to recognise
this.
I can write my own serializer to do this but would rather be generic if
possible as we will have many services in the end.
Any ideas, suggestions??




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

Date: Wed, 26 May 2004 10:40:15 +0200
From: Fatted <obeseted@yahoo.com>
Subject: Unpack and checksums
Message-Id: <2hj3hlFdkcf2U1@uni-berlin.de>

I'm trying to get unpack to generate a checksum but the result is always 0.
E.G.

my $string = 'ThisIsAString';

my $chksum = unpack("%H*",$string);

print $chksum."\n";


Results in 0.

perlfunc says unpack will generate the checksum (default 16 bit) if the 
template is preceded by %.
What am I missing?


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

Date: 26 May 2004 10:29:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Unpack and checksums
Message-Id: <c91rir$46i$1@mamenchi.zrz.TU-Berlin.DE>

Fatted  <obeseted@yahoo.com> wrote in comp.lang.perl.misc:
> I'm trying to get unpack to generate a checksum but the result is always 0.
> E.G.
> 
> my $string = 'ThisIsAString';
> 
> my $chksum = unpack("%H*",$string);
> 
> print $chksum."\n";
> 
> 
> Results in 0.
> 
> perlfunc says unpack will generate the checksum (default 16 bit) if the 
> template is preceded by %.
> What am I missing?

There seems to be a bug in unpack, which appears to return a spurious
0 with the "%H" format.  Try

    perl -le 'print join( " | ", unpack "%H*", "a")'

to see it.  As a workaround, use

    my ( $chksum) = unpack("%H*",$string);

Anno


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

Date: Wed, 26 May 2004 12:01:41 +0100
From: fifo <fifo@despammed.com>
Subject: Re: Unpack and checksums
Message-Id: <20040526110137.GA2750@fleece>

At 2004-05-26 10:29 +0000, Anno Siegel wrote:
> There seems to be a bug in unpack, which appears to return a spurious
> 0 with the "%H" format.  Try
> 
>     perl -le 'print join( " | ", unpack "%H*", "a")'
> 
> to see it.  As a workaround, use
> 
>     my ( $chksum) = unpack("%H*",$string);
> 

Isn't this just the same as doing

    my $chksum = unpack("H*",$string);

as unpack "H*" is only going to give you a single scalar anyway?


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

Date: 26 May 2004 11:12:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Unpack and checksums
Message-Id: <c91u2e$46i$3@mamenchi.zrz.TU-Berlin.DE>

fifo  <fifo@despammed.com> wrote in comp.lang.perl.misc:
> At 2004-05-26 10:29 +0000, Anno Siegel wrote:
> > There seems to be a bug in unpack, which appears to return a spurious
> > 0 with the "%H" format.  Try
> > 
> >     perl -le 'print join( " | ", unpack "%H*", "a")'
> > 
> > to see it.  As a workaround, use
> > 
> >     my ( $chksum) = unpack("%H*",$string);
> > 
> 
> Isn't this just the same as doing
> 
>     my $chksum = unpack("H*",$string);
> 
> as unpack "H*" is only going to give you a single scalar anyway?

We're not talking "H*" but "%H*".  There's a *bug*, and it doesn't
behave according to specification.

Please read for comprehension.

Anno


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

Date: Wed, 26 May 2004 13:38:59 +0200
From: Fatted <obeseted@yahoo.com>
Subject: Re: Unpack and checksums
Message-Id: <2hje0pFdm23qU1@uni-berlin.de>

Anno Siegel wrote:

> fifo  <fifo@despammed.com> wrote in comp.lang.perl.misc:
> 
>>Isn't this just the same as doing
>>
>>    my $chksum = unpack("H*",$string);
>>
>>as unpack "H*" is only going to give you a single scalar anyway?
> 
> 
> We're not talking "H*" but "%H*".  There's a *bug*, and it doesn't
> behave according to specification.
> 
> Please read for comprehension.
> 
> Anno

I don't think I follow either :(

take:

my $string = 'ThisIsAString';
# PERFORM PLAIN UNPACK
my $chksum = unpack("H*",$string)."\n";
print $chksum."\n";

gives:
54686973497341537472696e67

try:

my $string = 'ThisIsAString';
# PERFORM CHECKSUM UNPACK
my $chksum = unpack("%H*",$string);
print $chksum."\n";

gives:
0
as discussed

try suggested workaround:

my $string = 'ThisIsAString';
# PERFORM WORKAROUND CHECKSUM UNPACK
my ($chksum) = unpack("%H*",$string);
print $chksum."\n";

gives:
54686973497341537472696e67
which is the same result as the plain unpack and not the checksum sought.










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

Date: Wed, 26 May 2004 13:03:31 +0100
From: fifo <fifo@despammed.com>
Subject: Re: Unpack and checksums
Message-Id: <20040526120354.GB2750@fleece>

At 2004-05-26 11:12 +0000, Anno Siegel wrote:
> fifo  <fifo@despammed.com> wrote in comp.lang.perl.misc:
> > At 2004-05-26 10:29 +0000, Anno Siegel wrote:
> > > There seems to be a bug in unpack, which appears to return a spurious
> > > 0 with the "%H" format.  Try
> > > 
> > >     perl -le 'print join( " | ", unpack "%H*", "a")'
> > > 
> > > to see it.  As a workaround, use
> > > 
> > >     my ( $chksum) = unpack("%H*",$string);
> > > 
> > 
> > Isn't this just the same as doing
> > 
> >     my $chksum = unpack("H*",$string);
> > 
> > as unpack "H*" is only going to give you a single scalar anyway?
> 
> We're not talking "H*" but "%H*".  There's a *bug*, and it doesn't
> behave according to specification.
> 
> Please read for comprehension.

I agree that there's a bug with "%H*".  The point I was trying to make
was that "%H*" doesn't do anything useful over "H*" anyway, since it's
just 'summing' a single value.  I was thinking maybe the OP really meant
to use "%C*"?


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

Date: 26 May 2004 12:30:10 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Unpack and checksums
Message-Id: <c922ki$8k8$1@mamenchi.zrz.TU-Berlin.DE>

Fatted  <obeseted@yahoo.com> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> 
> > fifo  <fifo@despammed.com> wrote in comp.lang.perl.misc:
> > 
> >>Isn't this just the same as doing
> >>
> >>    my $chksum = unpack("H*",$string);
> >>
> >>as unpack "H*" is only going to give you a single scalar anyway?
> > 
> > 
> > We're not talking "H*" but "%H*".  There's a *bug*, and it doesn't
> > behave according to specification.
> > 
> > Please read for comprehension.
> > 
> > Anno
> 
> I don't think I follow either :(
> 
> take:
> 
> my $string = 'ThisIsAString';
> # PERFORM PLAIN UNPACK
> my $chksum = unpack("H*",$string)."\n";
> print $chksum."\n";
> 
> gives:
> 54686973497341537472696e67
> 
> try:
> 
> my $string = 'ThisIsAString';
> # PERFORM CHECKSUM UNPACK
> my $chksum = unpack("%H*",$string);
> print $chksum."\n";
> 
> gives:
> 0
> as discussed
> 
> try suggested workaround:
> 
> my $string = 'ThisIsAString';
> # PERFORM WORKAROUND CHECKSUM UNPACK
> my ($chksum) = unpack("%H*",$string);
> print $chksum."\n";
> 
> gives:
> 54686973497341537472696e67
> which is the same result as the plain unpack and not the checksum sought.

Ugh, you're right.  I didn't notice it doesn't do the checksum at all.
Forget the workaround, sorry.

Anno


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

Date: Tue, 25 May 2004 23:32:42 -0600
From: "James Hunt" <jameskorea2003@hotmail.com>
Subject: Re: Using Cookies With Perl
Message-Id: <JZKdnVjyn4BwtindRVn-jg@comcast.com>

wow amazing how a simple question can have such a response .....

James Hunt

"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7fz9okrzy.fsf@mail.sysarch.com...
> >>>>> "k" == krakle  <krakle@visto.com> writes:
>
>   k> Uri Guttman <uri@stemsystems.com> wrote in message
news:<x71xl9nnmg.fsf@mail.sysarch.com>...
>   >> >>>>> "k" == krakle  <krakle@visto.com> writes:
>   >>
>   k> "James Hunt" <jameskorea2003@hotmail.com> wrote in message
news:<d6udnXeKBqsK9y_dRVn-hQ@comcast.com>...
>   >> >> Does anyone have a good web reference for setting up and accessing
cookies
>   >> >> with Perl?
>   >> >>
>   >> >> - James Hunt
>   >>
>   k> This isn't a Perl question and has no excuse to be here.
>   k> Right on Tad?
>   >>
>   >> nope. you lose again. he asked a specific question about how to do
>   >> something in perl.
>
>   k> Wrong I asked how to do sessions in Perl. You just went off topic in
>   k> this guys thread. That's bad. Bad indeed.
>
> DING! DING! DING!!!!
>
> wow, you have no clue.
>
> uri
>
> --
> Uri Guttman  ------  uri@stemsystems.com  --------
http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and
Coding-
> Search or Offer Perl Jobs  ----------------------------
http://jobs.perl.org




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

Date: Wed, 26 May 2004 07:54:43 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Using Cookies With Perl
Message-Id: <pan.2004.05.26.05.54.43.600025@aursand.no>

On Tue, 25 May 2004 16:25:31 -0700, krakle wrote:
>> Cookies have nothing to do with sessions, other than the fact that you
>> can use cookies to obtain session-like states across the HTTP protocol.

> He brought up a continueing bicker from another thread into this thread.

That really doesn't matter, as long as the OP asks how to do "it" in Perl.

I could easily have been quite on-topic and asked how to create chocolate
cookies with Perl.


-- 
Tore Aursand <tore@aursand.no>
"When you see a good idea look for a better one. You should never play
 the first good move that comes into your head." (Bruce Pandolfine)


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 6610
***************************************


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