Re: array searching

2007-01-11 Thread John W. Krahn
Jim Canon wrote: > Hi, Hello, > This is my first question, I appreciate any information you provide. I want > to compare the numbers after : in @jn to the numbers after job in @job1 and > @job2. > > [ snip ] > > I want to put what is missing in @jn compared to @job1 and @job2 in > @jobMissing :

Re: remove duplicate lines

2007-01-11 Thread beast
Dr.Ruud wrote: while ( ) { next if $d{$_}; print; $d{$_} = 1; } Got the idea. Many thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

array searching

2007-01-11 Thread Jim Canon
Hi, This is my first question, I appreciate any information you provide. I want to compare the numbers after : in @jn to the numbers after job in @job1 and @job2. @jn = JN.2007:555 JN.2007:8433 JN.2007:594 JN.2007:111 JN.2007:4663 JN.2007.321 JN.2007:2221 @job1 = job555 job572 job8433 job873

Re: remove duplicate lines

2007-01-11 Thread Dr.Ruud
"Dr.Ruud" schreef: > beast: >> a 100 >> a 102 >> ... >> c 100 >> a 102 >> ... >> >> I would like to have a list (either array or hash) with unique line . > > perl -ne'$_{$_}||=print' datafile Jason Roth's version: perl -ne'$$_||=print' datafile > or > > perl -pe'$_ x=!$$_++' datafile -

Re: remove duplicate lines

2007-01-11 Thread oryann9
"Dr.Ruud" <[EMAIL PROTECTED]> wrote:oryann9 schreef: > "Dr.Ruud" wrote: beast schreef: >> beast: >>> a 100 >>> a 102 >>> c 100 >>> a 102 >>> b 111 >>> c 100 >>> c 102 >>> c 100 >>> c 100 >>> a 102 >>> ... >>> >>> I would like to have a list (either array or hash) with unique line . >> >> per

Re: printing to a file if line is not there

2007-01-11 Thread John W. Krahn
FamiLink Admin wrote: > Hello all. Hello, > I am trying to read a log file then look for a website and score. If > that website has a score >100, take it and add it to a "Check me" list. It would be easier to help if we could see examples of valid and invalid log file entries. > 1. I don't wan

Re: Remote directory

2007-01-11 Thread Ricky Zhou
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dukelow, Don wrote: > Does anyone have a favorite method the checks for existence of a file or > directory on remote system. I know it can be done with a system call, but > can Perl do it within its self? If you look in perldoc -f -X, there is a list

Re: remove duplicate lines

2007-01-11 Thread Jason Roth
If we're just going for confusing concise one liners then I would use perl -ne '$$_||=print' You save three whole characters by using the symbol table instead of a hash :) On 1/11/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: oryann9 schreef: > "Dr.Ruud" <[EMAIL PROTECTED]> wrote: beast schreef: >>

Remote directory

2007-01-11 Thread Dukelow, Don
Does anyone have a favorite method the checks for existence of a file or directory on remote system. I know it can be done with a system call, but can Perl do it within its self? Don Dukelow smime.p7s Description: S/MIME cryptographic signature

Re: remove duplicate lines

2007-01-11 Thread Dr.Ruud
oryann9 schreef: > "Dr.Ruud" <[EMAIL PROTECTED]> wrote: beast schreef: >> beast: >>> a 100 >>> a 102 >>> c 100 >>> a 102 >>> b 111 >>> c 100 >>> c 102 >>> c 100 >>> c 100 >>> a 102 >>> ... >>> >>> I would like to have a list (either array or hash) with unique line . >> >> perl -ne'$_{$_}||=print

HoH and HoHoH

2007-01-11 Thread oryann9
HoH 'jblow' => { 'uid' => '2195', 'gecos' => 'Joe Blow,,,', 'gid' => '20' }, snippet. ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' ); $hash1{$name} -> {'uid'}

HoH and HoHoH

2007-01-11 Thread oryann9
HoH 'jblow' => { 'uid' => '2195', 'gecos' => 'Joe Blow,,,', 'gid' => '20' }, snippet. ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' ); $hash1{$name} -> {'uid'}

Re: Checking for infinite loops

2007-01-11 Thread Jay Savage
On 1/11/07, hOURS <[EMAIL PROTECTED]> wrote: Jay Savage <[EMAIL PROTECTED]> wrote: On 1/11/07, hOURS wrote: > > > Jay Savage wrote: On 1/11/07, hOURS wrote: > [snip] > Thanks Jay. I can't believe I didn't think of that myself. I put in the 1;'s and the "or die". It's not that the requi

Re: Checking for infinite loops

2007-01-11 Thread hOURS
Jay Savage <[EMAIL PROTECTED]> wrote: On 1/11/07, hOURS wrote: > > > Jay Savage wrote: On 1/11/07, hOURS wrote: > [snip] > Thanks Jay. I can't believe I didn't think of that myself. I put in the > 1;'s and the "or die". It's not that the requires are failing - I get the > same results.

Re: finding a replacing 0a in strings

2007-01-11 Thread Dr.Ruud
"Mumia W." schreef: > Beginner: >> This is the sequence I would like to change to a single space: >> 20a020a020a0 > > AFAIK, tr/// can't do this. As Tom wrote: tr/\xA0\x20/\x20/s Variant: tr/\t\n\f\r \xA0/ /s -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTE

Re: Checking for infinite loops

2007-01-11 Thread Jay Savage
On 1/11/07, hOURS <[EMAIL PROTECTED]> wrote: Jay Savage <[EMAIL PROTECTED]> wrote: On 1/11/07, hOURS wrote: [snip] Thanks Jay. I can't believe I didn't think of that myself. I put in the 1;'s and the "or die". It's not that the requires are failing - I get the same results. I adde

Re: Checking for infinite loops

2007-01-11 Thread hOURS
Jay Savage <[EMAIL PROTECTED]> wrote: On 1/11/07, hOURS wrote: [snip] > Some modifications I made: I changed the names of the programs being tested > to fit what I had. I reduced the alarm time from one hour down to a few > seconds. I included statements to print out error messages. (The

printing to a file if line is not there

2007-01-11 Thread FamiLink Admin
Hello all. I am trying to read a log file then look for a website and score. If that website has a score >100, take it and add it to a "Check me" list. 1. I don't want to "recheck" so I have a list of checked sites that I want to verify with. 2. I don't want duplicates added to the "check m

Re: Converting to capital only one word in a line

2007-01-11 Thread John W. Krahn
Emilio Casbas wrote: > I know that this is not a exact perl question, but maybe someone has a > perl solution. > > You have the passwd file such this: > > > test:x:593:501::/usr/local/etc5/test:/bin/bash > >

Re: Checking for infinite loops

2007-01-11 Thread Jay Savage
On 1/11/07, hOURS <[EMAIL PROTECTED]> wrote: [snip] Some modifications I made: I changed the names of the programs being tested to fit what I had. I reduced the alarm time from one hour down to a few seconds. I included statements to print out error messages. (The original if and

Converting to capital only one word in a line

2007-01-11 Thread Emilio Casbas
I know that this is not a exact perl question, but maybe someone has a perl solution. You have the passwd file such this: test:x:593:501::/usr/local/etc5/test:/bin/bash and you have to convert it to: ---

Re: Checking for infinite loops

2007-01-11 Thread hOURS
Dave Gray <[EMAIL PROTECTED]> wrote: On 1/8/07, hOURS wrote: > Hi everyone, > Jay offered me the following code to help with something. I don't undertand > it, but tried to use it anyway to see if it would work. The computer told me > there was a syntax error in the area I highlighted in

Re: XML::LibXML navigation

2007-01-11 Thread Randal L. Schwartz
> ""Beginner"" == "Beginner" <[EMAIL PROTECTED]> writes: "Beginner"> I have to do some sanity checks on a large xml file of addresses "Beginner"> (snip below). I have been using XML::LibXML and seem to have started "Beginner"> ok but I am struggling to navigate around a record. Take a loo

Re: remove duplicate lines

2007-01-11 Thread oryann9
"Dr.Ruud" <[EMAIL PROTECTED]> wrote: beast schreef: > a 100 > a 102 > c 100 > a 102 > b 111 > c 100 > c 102 > c 100 > c 100 > a 102 > ... > > I would like to have a list (either array or hash) with unique line . perl -ne'$_{$_}||=print' datafile or perl -pe'$_ x=!$$_++' datafile -- Affi

XML::LibXML navigation

2007-01-11 Thread Beginner
Hi, I have to do some sanity checks on a large xml file of addresses (snip below). I have been using XML::LibXML and seem to have started ok but I am struggling to navigate around a record. In the sample date below your'll see some addresses with "DO NOT..." in. I can locate them easily enough

Net::BitTorrent::File problems

2007-01-11 Thread Andy Greenwood
I'm trying to extract the SHA1 hashes out of a .torrent file using Net::BitTorrent::File, among other information, but can't seem to figure out how to get them. I keep getting binary data, not the ascii hash. Can anyone tell me what I'm doing wrong here? #!/usr/bin/perl use strict; use warnings;

RE: Calling a perl program from a perl script

2007-01-11 Thread Bipin_Upadhyay
I need to call that program from a perl script. I tried this using eval function. But it failed. Can i know how to do this? Hi, I am not sure, so I'll frame an answer for my answer :D "Wouldn't it work if you first determined the OS and then made a system call accordingly... Like: System(/*pr

Re: Video and perl

2007-01-11 Thread Herman Gerritsen
I have borrowed a Logitech Quickcam messenger (046d:08f0) from my brother. Got the driver working (in essence it creates the /dev/video0) but it keeps crashing my players. Mplayer and ffmpeg crashes, Xawtv manages to get moving images for about a second and crashes afterwards. So got to figure th

Re: Redefining the behaviour of warn.

2007-01-11 Thread Muttley Meen
On 1/10/07, Peter Scott <[EMAIL PROTECTED]> wrote: On Wed, 10 Jan 2007 08:32:26 -0500, Muttley Meen wrote: > On 1/10/07, Peter Scott <[EMAIL PROTECTED]> wrote: >> On Wed, 10 Jan 2007 07:37:24 -0500, Muttley Meen wrote: >> > I have the code: >> > $SIG{__WARN__} = sub { print $_[0]; } ; >> >> perld

Re: how to force html4 output

2007-01-11 Thread Beginner
On 11 Jan 2007 at 2:49, Oliver Block wrote: > Hello list, > > first of all a blessed 2007 to all of you. > > Can anyone tell me, if there is a way to force CGI.pm to deliver the html > code > with a DOCTYPE switch for HTML4 and not XHTML? > > As there are some problems with the media type for

Re: Redefining the behaviour of warn.

2007-01-11 Thread Ken Foskey
On Wed, 2007-01-10 at 07:37 -0500, Muttley Meen wrote: > Hi. > > I have the code: > > $SIG{__WARN__} = sub { print $_[0]; } ; > > I'm expecting that when i use > warn "WARN"; only "WARN" will be printed to STDERR, no other text. > but perl is smart to tell me the file and the line, even though I

RE: Calling a perl program from a perl script

2007-01-11 Thread Nagasamudram, Prasanna Kumar
-Original Message- From: Dharshana Eswaran [mailto:[EMAIL PROTECTED] Sent: Thursday, January 11, 2007 12:12 PM To: Jeff Pang Cc: Perl Beginners Subject: Re: Calling a perl program from a perl script On 1/11/07, Jeff Pang <[EMAIL PROTECTED]> wrote: > > > >I Have a perl program which runs