[19173] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1368 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 24 11:10:31 2001

Date: Tue, 24 Jul 2001 08:10:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <995987409-v10-i1368@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 24 Jul 2001     Volume: 10 Number: 1368

Today's topics:
    Re: Sorting an array of strings by 'closeness' to anoth <jpixton@dircon.co.uk>
    Re: Splitting Peculiar HTML <iltzu@sci.invalid>
    Re: Splitting Peculiar HTML <godzilla@stomp.stomp.tokyo>
    Re: string extraction (Anno Siegel)
        The wonderful world of SSH <noemail@noemail.com>
    Re: Upgrade Perl on RH7.1 From Source (Kevin der Kinderen)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 24 Jul 2001 15:55:23 +0100
From: jbp <jpixton@dircon.co.uk>
Subject: Re: Sorting an array of strings by 'closeness' to another string
Message-Id: <ar2rltcq4tau81pfkh77821ebctf83qs0k@4ax.com>

At Tue, 24 Jul 2001 12:10:44 +0100, Jasper McCrea said:
>Jasper McCrea wrote:
>> 
>> jbp wrote:
>> >
>
>> 
>> Actually, this method should really bias towards a single typo better
>> (eg, if one letter was z when it should have been a, the counter sub
>> would return a big ish diff, bigger than if all the letters were just
>> one off). This might be done by $ascii_diff *= 100, or something. Not
>> sure.
>
>Thinking about this a bit more, and what you really want, I think, is a
>method that returns based on bad typo on a QWERTY keyboard. 
>
>so you'd get 
>
>%qwerty = { a => { a => 0,
>                   b => 5,
>                   c => 3,
>                   d => 2,
>                   e => 2,
>                   ....
>                  },
>             b => { a => 5,
>                    b => 0,
>                    c => 2,
>                   ....
>             c => ..
>             d => ..
>            };
>
>etc. etc. You get the idea. And instead of saying ascii_diff (like I had
>in my previous reply), you'd say 
>
>$qwerty_diff = $qwerty{$your_letter}{$word_letter};
>
>and total that for each letter of the words.
>(there's a good exercise in here of writing a sub to work out the
>$qwerty_diff knowing the keyboard 'coordinates' of each key, but I can't
>be arsed right now).

I can :)

make_qwerty_map();
make_distance_map();

sub make_qwerty_map
{
	$keyboard{a}{'x'} = 0;
	$keyboard{a}{'y'} = 1;

	$keyboard{b}{'x'} = 4;
	$keyboard{b}{'y'} = 0;

	$keyboard{c}{'x'} = 2;
	$keyboard{c}{'y'} = 0;

	$keyboard{d}{'x'} = 2;
	$keyboard{d}{'y'} = 1;

	$keyboard{e}{'x'} = 2;
	$keyboard{e}{'y'} = 2;

	$keyboard{f}{'x'} = 3;
	$keyboard{f}{'y'} = 1;

	$keyboard{g}{'x'} = 4;
	$keyboard{g}{'y'} = 1;

	$keyboard{h}{'x'} = 5;
	$keyboard{h}{'y'} = 1;

	$keyboard{i}{'x'} = 7;
	$keyboard{i}{'y'} = 2;

	$keyboard{j}{'x'} = 6;
	$keyboard{j}{'y'} = 1;

	$keyboard{k}{'x'} = 7;
	$keyboard{k}{'y'} = 1;

	$keyboard{l}{'x'} = 8;
	$keyboard{l}{'y'} = 1;

	$keyboard{m}{'x'} = 6;
	$keyboard{m}{'y'} = 0;

	$keyboard{n}{'x'} = 5;
	$keyboard{n}{'y'} = 0;

	$keyboard{o}{'x'} = 8;
	$keyboard{o}{'y'} = 2;

	$keyboard{p}{'x'} = 9;
	$keyboard{p}{'y'} = 2;

	$keyboard{q}{'x'} = 0;
	$keyboard{q}{'y'} = 2;

	$keyboard{r}{'x'} = 3;
	$keyboard{r}{'y'} = 2;

	$keyboard{s}{'x'} = 1;
	$keyboard{s}{'y'} = 1;

	$keyboard{t}{'x'} = 4;
	$keyboard{t}{'y'} = 2;

	$keyboard{u}{'x'} = 6;
	$keyboard{u}{'y'} = 2;

	$keyboard{v}{'x'} = 3;
	$keyboard{v}{'y'} = 0;

	$keyboard{w}{'x'} = 1;
	$keyboard{w}{'y'} = 2;

	$keyboard{x}{'x'} = 1;
	$keyboard{x}{'y'} = 0;

	$keyboard{y}{'x'} = 5;
	$keyboard{y}{'y'} = 2;

	$keyboard{z}{'x'} = 0;
	$keyboard{z}{'y'} = 0;
}

sub make_distance_map
{
	for ('a'..'z')
	{
		$letter = $_;
		
		for ('a'..'z')
		{
			$target = $_;
			
			my $this_distance_x = $keyboard{$letter}{'x'} -
$keyboard{$target}{'x'};
			my $this_distance_y = $keyboard{$letter}{'y'} -
$keyboard{$target}{'y'};
			$distance{$letter}{$target} = sqrt(($this_distance_x *
$this_distance_x) + ($this_distance_y * $this_distance_y));
			
			printf("   %s to %s is %02.2f\n", $letter, $target,
$distance{$letter}{$target});
		}
		
		print "\n";
	}
}

Which returns:

   a to a is 0.00
   a to b is 4.12
   a to c is 2.24
   a to d is 2.00
   a to e is 2.24
   a to f is 3.00
   a to g is 4.00
   a to h is 5.00
   a to i is 7.07
   a to j is 6.00
   a to k is 7.00
   a to l is 8.00
   a to m is 6.08
   a to n is 5.10
   a to o is 8.06
   a to p is 9.06
   a to q is 1.00
   a to r is 3.16
   a to s is 1.00
   a to t is 4.12
   a to u is 6.08
   a to v is 3.16
   a to w is 1.41
   a to x is 1.41
   a to y is 5.10
   a to z is 1.00

   b to a is 4.12
   b to b is 0.00
   b to c is 2.00
   b to d is 2.24
   b to e is 2.83
   b to f is 1.41
   b to g is 1.00
   b to h is 1.41
   b to i is 3.61
   b to j is 2.24
   b to k is 3.16
   b to l is 4.12
   b to m is 2.00
   b to n is 1.00
   b to o is 4.47
   b to p is 5.39
   b to q is 4.47
   b to r is 2.24
   b to s is 3.16
   b to t is 2.00
   b to u is 2.83
   b to v is 1.00
   b to w is 3.61
   b to x is 3.00
   b to y is 2.24
   b to z is 4.00

   c to a is 2.24
   c to b is 2.00
   c to c is 0.00
   c to d is 1.00
   c to e is 2.00
   c to f is 1.41
   c to g is 2.24
   c to h is 3.16
   c to i is 5.39
   c to j is 4.12
   c to k is 5.10
   c to l is 6.08
   c to m is 4.00
   c to n is 3.00
   c to o is 6.32
   c to p is 7.28
   c to q is 2.83
   c to r is 2.24
   c to s is 1.41
   c to t is 2.83
   c to u is 4.47
   c to v is 1.00
   c to w is 2.24
   c to x is 1.00
   c to y is 3.61
   c to z is 2.00

   d to a is 2.00
   d to b is 2.24
   d to c is 1.00
   d to d is 0.00
   d to e is 1.00
   d to f is 1.00
   d to g is 2.00
   d to h is 3.00
   d to i is 5.10
   d to j is 4.00
   d to k is 5.00
   d to l is 6.00
   d to m is 4.12
   d to n is 3.16
   d to o is 6.08
   d to p is 7.07
   d to q is 2.24
   d to r is 1.41
   d to s is 1.00
   d to t is 2.24
   d to u is 4.12
   d to v is 1.41
   d to w is 1.41
   d to x is 1.41
   d to y is 3.16
   d to z is 2.24

   e to a is 2.24
   e to b is 2.83
   e to c is 2.00
   e to d is 1.00
   e to e is 0.00
   e to f is 1.41
   e to g is 2.24
   e to h is 3.16
   e to i is 5.00
   e to j is 4.12
   e to k is 5.10
   e to l is 6.08
   e to m is 4.47
   e to n is 3.61
   e to o is 6.00
   e to p is 7.00
   e to q is 2.00
   e to r is 1.00
   e to s is 1.41
   e to t is 2.00
   e to u is 4.00
   e to v is 2.24
   e to w is 1.00
   e to x is 2.24
   e to y is 3.00
   e to z is 2.83

   f to a is 3.00
   f to b is 1.41
   f to c is 1.41
   f to d is 1.00
   f to e is 1.41
   f to f is 0.00
   f to g is 1.00
   f to h is 2.00
   f to i is 4.12
   f to j is 3.00
   f to k is 4.00
   f to l is 5.00
   f to m is 3.16
   f to n is 2.24
   f to o is 5.10
   f to p is 6.08
   f to q is 3.16
   f to r is 1.00
   f to s is 2.00
   f to t is 1.41
   f to u is 3.16
   f to v is 1.00
   f to w is 2.24
   f to x is 2.24
   f to y is 2.24
   f to z is 3.16

   g to a is 4.00
   g to b is 1.00
   g to c is 2.24
   g to d is 2.00
   g to e is 2.24
   g to f is 1.00
   g to g is 0.00
   g to h is 1.00
   g to i is 3.16
   g to j is 2.00
   g to k is 3.00
   g to l is 4.00
   g to m is 2.24
   g to n is 1.41
   g to o is 4.12
   g to p is 5.10
   g to q is 4.12
   g to r is 1.41
   g to s is 3.00
   g to t is 1.00
   g to u is 2.24
   g to v is 1.41
   g to w is 3.16
   g to x is 3.16
   g to y is 1.41
   g to z is 4.12

   h to a is 5.00
   h to b is 1.41
   h to c is 3.16
   h to d is 3.00
   h to e is 3.16
   h to f is 2.00
   h to g is 1.00
   h to h is 0.00
   h to i is 2.24
   h to j is 1.00
   h to k is 2.00
   h to l is 3.00
   h to m is 1.41
   h to n is 1.00
   h to o is 3.16
   h to p is 4.12
   h to q is 5.10
   h to r is 2.24
   h to s is 4.00
   h to t is 1.41
   h to u is 1.41
   h to v is 2.24
   h to w is 4.12
   h to x is 4.12
   h to y is 1.00
   h to z is 5.10

   i to a is 7.07
   i to b is 3.61
   i to c is 5.39
   i to d is 5.10
   i to e is 5.00
   i to f is 4.12
   i to g is 3.16
   i to h is 2.24
   i to i is 0.00
   i to j is 1.41
   i to k is 1.00
   i to l is 1.41
   i to m is 2.24
   i to n is 2.83
   i to o is 1.00
   i to p is 2.00
   i to q is 7.00
   i to r is 4.00
   i to s is 6.08
   i to t is 3.00
   i to u is 1.00
   i to v is 4.47
   i to w is 6.00
   i to x is 6.32
   i to y is 2.00
   i to z is 7.28

   j to a is 6.00
   j to b is 2.24
   j to c is 4.12
   j to d is 4.00
   j to e is 4.12
   j to f is 3.00
   j to g is 2.00
   j to h is 1.00
   j to i is 1.41
   j to j is 0.00
   j to k is 1.00
   j to l is 2.00
   j to m is 1.00
   j to n is 1.41
   j to o is 2.24
   j to p is 3.16
   j to q is 6.08
   j to r is 3.16
   j to s is 5.00
   j to t is 2.24
   j to u is 1.00
   j to v is 3.16
   j to w is 5.10
   j to x is 5.10
   j to y is 1.41
   j to z is 6.08

   k to a is 7.00
   k to b is 3.16
   k to c is 5.10
   k to d is 5.00
   k to e is 5.10
   k to f is 4.00
   k to g is 3.00
   k to h is 2.00
   k to i is 1.00
   k to j is 1.00
   k to k is 0.00
   k to l is 1.00
   k to m is 1.41
   k to n is 2.24
   k to o is 1.41
   k to p is 2.24
   k to q is 7.07
   k to r is 4.12
   k to s is 6.00
   k to t is 3.16
   k to u is 1.41
   k to v is 4.12
   k to w is 6.08
   k to x is 6.08
   k to y is 2.24
   k to z is 7.07

   l to a is 8.00
   l to b is 4.12
   l to c is 6.08
   l to d is 6.00
   l to e is 6.08
   l to f is 5.00
   l to g is 4.00
   l to h is 3.00
   l to i is 1.41
   l to j is 2.00
   l to k is 1.00
   l to l is 0.00
   l to m is 2.24
   l to n is 3.16
   l to o is 1.00
   l to p is 1.41
   l to q is 8.06
   l to r is 5.10
   l to s is 7.00
   l to t is 4.12
   l to u is 2.24
   l to v is 5.10
   l to w is 7.07
   l to x is 7.07
   l to y is 3.16
   l to z is 8.06

   m to a is 6.08
   m to b is 2.00
   m to c is 4.00
   m to d is 4.12
   m to e is 4.47
   m to f is 3.16
   m to g is 2.24
   m to h is 1.41
   m to i is 2.24
   m to j is 1.00
   m to k is 1.41
   m to l is 2.24
   m to m is 0.00
   m to n is 1.00
   m to o is 2.83
   m to p is 3.61
   m to q is 6.32
   m to r is 3.61
   m to s is 5.10
   m to t is 2.83
   m to u is 2.00
   m to v is 3.00
   m to w is 5.39
   m to x is 5.00
   m to y is 2.24
   m to z is 6.00

   n to a is 5.10
   n to b is 1.00
   n to c is 3.00
   n to d is 3.16
   n to e is 3.61
   n to f is 2.24
   n to g is 1.41
   n to h is 1.00
   n to i is 2.83
   n to j is 1.41
   n to k is 2.24
   n to l is 3.16
   n to m is 1.00
   n to n is 0.00
   n to o is 3.61
   n to p is 4.47
   n to q is 5.39
   n to r is 2.83
   n to s is 4.12
   n to t is 2.24
   n to u is 2.24
   n to v is 2.00
   n to w is 4.47
   n to x is 4.00
   n to y is 2.00
   n to z is 5.00

   o to a is 8.06
   o to b is 4.47
   o to c is 6.32
   o to d is 6.08
   o to e is 6.00
   o to f is 5.10
   o to g is 4.12
   o to h is 3.16
   o to i is 1.00
   o to j is 2.24
   o to k is 1.41
   o to l is 1.00
   o to m is 2.83
   o to n is 3.61
   o to o is 0.00
   o to p is 1.00
   o to q is 8.00
   o to r is 5.00
   o to s is 7.07
   o to t is 4.00
   o to u is 2.00
   o to v is 5.39
   o to w is 7.00
   o to x is 7.28
   o to y is 3.00
   o to z is 8.25

   p to a is 9.06
   p to b is 5.39
   p to c is 7.28
   p to d is 7.07
   p to e is 7.00
   p to f is 6.08
   p to g is 5.10
   p to h is 4.12
   p to i is 2.00
   p to j is 3.16
   p to k is 2.24
   p to l is 1.41
   p to m is 3.61
   p to n is 4.47
   p to o is 1.00
   p to p is 0.00
   p to q is 9.00
   p to r is 6.00
   p to s is 8.06
   p to t is 5.00
   p to u is 3.00
   p to v is 6.32
   p to w is 8.00
   p to x is 8.25
   p to y is 4.00
   p to z is 9.22

   q to a is 1.00
   q to b is 4.47
   q to c is 2.83
   q to d is 2.24
   q to e is 2.00
   q to f is 3.16
   q to g is 4.12
   q to h is 5.10
   q to i is 7.00
   q to j is 6.08
   q to k is 7.07
   q to l is 8.06
   q to m is 6.32
   q to n is 5.39
   q to o is 8.00
   q to p is 9.00
   q to q is 0.00
   q to r is 3.00
   q to s is 1.41
   q to t is 4.00
   q to u is 6.00
   q to v is 3.61
   q to w is 1.00
   q to x is 2.24
   q to y is 5.00
   q to z is 2.00

   r to a is 3.16
   r to b is 2.24
   r to c is 2.24
   r to d is 1.41
   r to e is 1.00
   r to f is 1.00
   r to g is 1.41
   r to h is 2.24
   r to i is 4.00
   r to j is 3.16
   r to k is 4.12
   r to l is 5.10
   r to m is 3.61
   r to n is 2.83
   r to o is 5.00
   r to p is 6.00
   r to q is 3.00
   r to r is 0.00
   r to s is 2.24
   r to t is 1.00
   r to u is 3.00
   r to v is 2.00
   r to w is 2.00
   r to x is 2.83
   r to y is 2.00
   r to z is 3.61

   s to a is 1.00
   s to b is 3.16
   s to c is 1.41
   s to d is 1.00
   s to e is 1.41
   s to f is 2.00
   s to g is 3.00
   s to h is 4.00
   s to i is 6.08
   s to j is 5.00
   s to k is 6.00
   s to l is 7.00
   s to m is 5.10
   s to n is 4.12
   s to o is 7.07
   s to p is 8.06
   s to q is 1.41
   s to r is 2.24
   s to s is 0.00
   s to t is 3.16
   s to u is 5.10
   s to v is 2.24
   s to w is 1.00
   s to x is 1.00
   s to y is 4.12
   s to z is 1.41

   t to a is 4.12
   t to b is 2.00
   t to c is 2.83
   t to d is 2.24
   t to e is 2.00
   t to f is 1.41
   t to g is 1.00
   t to h is 1.41
   t to i is 3.00
   t to j is 2.24
   t to k is 3.16
   t to l is 4.12
   t to m is 2.83
   t to n is 2.24
   t to o is 4.00
   t to p is 5.00
   t to q is 4.00
   t to r is 1.00
   t to s is 3.16
   t to t is 0.00
   t to u is 2.00
   t to v is 2.24
   t to w is 3.00
   t to x is 3.61
   t to y is 1.00
   t to z is 4.47

   u to a is 6.08
   u to b is 2.83
   u to c is 4.47
   u to d is 4.12
   u to e is 4.00
   u to f is 3.16
   u to g is 2.24
   u to h is 1.41
   u to i is 1.00
   u to j is 1.00
   u to k is 1.41
   u to l is 2.24
   u to m is 2.00
   u to n is 2.24
   u to o is 2.00
   u to p is 3.00
   u to q is 6.00
   u to r is 3.00
   u to s is 5.10
   u to t is 2.00
   u to u is 0.00
   u to v is 3.61
   u to w is 5.00
   u to x is 5.39
   u to y is 1.00
   u to z is 6.32

   v to a is 3.16
   v to b is 1.00
   v to c is 1.00
   v to d is 1.41
   v to e is 2.24
   v to f is 1.00
   v to g is 1.41
   v to h is 2.24
   v to i is 4.47
   v to j is 3.16
   v to k is 4.12
   v to l is 5.10
   v to m is 3.00
   v to n is 2.00
   v to o is 5.39
   v to p is 6.32
   v to q is 3.61
   v to r is 2.00
   v to s is 2.24
   v to t is 2.24
   v to u is 3.61
   v to v is 0.00
   v to w is 2.83
   v to x is 2.00
   v to y is 2.83
   v to z is 3.00

   w to a is 1.41
   w to b is 3.61
   w to c is 2.24
   w to d is 1.41
   w to e is 1.00
   w to f is 2.24
   w to g is 3.16
   w to h is 4.12
   w to i is 6.00
   w to j is 5.10
   w to k is 6.08
   w to l is 7.07
   w to m is 5.39
   w to n is 4.47
   w to o is 7.00
   w to p is 8.00
   w to q is 1.00
   w to r is 2.00
   w to s is 1.00
   w to t is 3.00
   w to u is 5.00
   w to v is 2.83
   w to w is 0.00
   w to x is 2.00
   w to y is 4.00
   w to z is 2.24

   x to a is 1.41
   x to b is 3.00
   x to c is 1.00
   x to d is 1.41
   x to e is 2.24
   x to f is 2.24
   x to g is 3.16
   x to h is 4.12
   x to i is 6.32
   x to j is 5.10
   x to k is 6.08
   x to l is 7.07
   x to m is 5.00
   x to n is 4.00
   x to o is 7.28
   x to p is 8.25
   x to q is 2.24
   x to r is 2.83
   x to s is 1.00
   x to t is 3.61
   x to u is 5.39
   x to v is 2.00
   x to w is 2.00
   x to x is 0.00
   x to y is 4.47
   x to z is 1.00

   y to a is 5.10
   y to b is 2.24
   y to c is 3.61
   y to d is 3.16
   y to e is 3.00
   y to f is 2.24
   y to g is 1.41
   y to h is 1.00
   y to i is 2.00
   y to j is 1.41
   y to k is 2.24
   y to l is 3.16
   y to m is 2.24
   y to n is 2.00
   y to o is 3.00
   y to p is 4.00
   y to q is 5.00
   y to r is 2.00
   y to s is 4.12
   y to t is 1.00
   y to u is 1.00
   y to v is 2.83
   y to w is 4.00
   y to x is 4.47
   y to y is 0.00
   y to z is 5.39

   z to a is 1.00
   z to b is 4.00
   z to c is 2.00
   z to d is 2.24
   z to e is 2.83
   z to f is 3.16
   z to g is 4.12
   z to h is 5.10
   z to i is 7.28
   z to j is 6.08
   z to k is 7.07
   z to l is 8.06
   z to m is 6.00
   z to n is 5.00
   z to o is 8.25
   z to p is 9.22
   z to q is 2.00
   z to r is 3.61
   z to s is 1.41
   z to t is 4.47
   z to u is 6.32
   z to v is 3.00
   z to w is 2.24
   z to x is 1.00
   z to y is 5.39
   z to z is 0.00

Which is exactly what I need :))

>I haven't, and I'm not about to test any of this. And I'm pretty sure
>that if I've come up with this crap in two minutes, there's far better
>code out there to do what you want exactly.

Thanks so much for helping me, you've really given me a really good
start.

Cheers.

-- 
Joseph Birr-Pixton .:|:. http://ifihada.com .:|:. ICQ#40675236  
<?$n='12 56 d6 96 47 02 66 f6 02 56 47 37 16 77 02 16 02 47 16 86 75';
$code=';))i$(cedxeh(rhc ohce )i$ sa))n$(verrts," "(edolpxe(hcaerof';
eval(strrev($code));?>


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

Date: 24 Jul 2001 14:01:21 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Splitting Peculiar HTML
Message-Id: <995982895.7568@itz.pp.sci.fi>

In article <60805a5e.0107231752.34ae92a9@posting.google.com>, Bill Atkins wrote:
>Given the following HTML code:
>
>gtgtgtgtgtgtgtgtgtaaaag<font color="blue">acacggc</font>aattaatatcgtggcgagacctt
>
>is there any way to divide the text into groups of ten without
>including the HTML tags?

  s/((?:(?:<[^>]*>)?[acgt]){10})/$1 /g;

Tweak the regex to suit your needs.  /<[^>]*>/ isn't actually enough to
properly match an HTML tag, but it'll do as long as your tags won't have
any ">" characters in quoted strings.  For a more complete regex, search
the archives of this group at http://groups.google.com/

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: Tue, 24 Jul 2001 07:54:52 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Splitting Peculiar HTML
Message-Id: <3B5D8C3C.4761F60C@stomp.stomp.tokyo>

Tassilo von Parseval wrote:
 
> Godzilla! wrote:
> >Bill Atkins wrote:


(snippage not noted by Atkins aka Parseval aka The CLPM Troll)


> >>is there any way to divide the text into groups of ten without
> >>including the HTML tags?  For instance, the result would be:

> >><font color="blue">agggg</font>cgagc cgagcgcagt tgcacgtacc ttgccaaa


> >Here is some help. You have contradicted yourself
> >within the same breath. You say you want html tags
> >removed, then cite an example displaying html
> >tags. Consider resolving your confusion, then
> >write and post a coherent article.

> No, he has not. He does not want the html-tags to be removed. Instead he
> wants to skip html-tags when making the groups of ten.
> I am not yet sure, Godzilla!. but reading your replies here makes me
> wonder whether you prefer to help people or implicitely insult them.


Are you the originating author's loving mouth piece?


Godzilla!


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

Date: 24 Jul 2001 14:45:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: string extraction
Message-Id: <9jk1lt$60m$1@mamenchi.zrz.TU-Berlin.DE>

According to shaz <ssa1701@yahoo.co.uk>:
> Does anyone know how to go about extracting keywords from text files?
> The following code only finds some words in the text file but does not
> show the no of occurances of each word.

Well, count the occurrences.  You have an "if" in place for each
keyword, so what's the problem?  Then print them.
 
> I'll get the answer after a while but i would appriecate a little
> help. The file is:-

You do need some help, but why you want it for the counting
problem is beyond me.

> #!/usr/bin/perl -w

Warnings switched on, that's good. You should "use strict" too.

> print "Enter the name of the word file, including extension: "; 
> 
> $file=<STDIN>;
> chomp $file;
> 
> open(W, "$file") || die "Cannot open wordfile: $!";
> @lines=<W>;
> close(W);

Why do you think it's a good idea to read the whole file into an
array?  You are walking through the array line by line anyhow.
A while loop over <W> is all you need.

> foreach(@lines) 
> {
>   if (/\w\s<NN>/g) 

So you want to register a hit only if the keyword is preceded by
a word character and a single whitespace character?

The /g modificator is useless in a simple match.

>   {
>     print "$_";

No quotes needed around $_.  In fact, even $_ isn't needed, because
"print" prints that by default.

>   }
> 
>   if (/\w\s<VBZ>/g) 
>   {
>     print "$_";
>   }
> }
> 

It may print a line twice if it matches both keywords, but perhaps
that's no concern.

Putting things together (assuming the file has been opened to W):

    my ( $count_nn, $count_vbz);
    while ( <W> ) {
        if ( /\w\s<NN>/ ) {
            $count_nn++;
            print;
        }
        if ( /\w\s<VBZ>/ ) {
            $count_vbz++;
            print;
        }
    }
    print "Seen <NN> $count_nn times\n";
    print "Seen <VBZ> $count_vbz times\n";

Oh... this is untested.

Anno


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

Date: Tue, 24 Jul 2001 13:41:07 GMT
From: "Thing" <noemail@noemail.com>
Subject: The wonderful world of SSH
Message-Id: <TVe77.10099$Px1.1195762@newsread2.prod.itd.earthlink.net>

My goal is to have a secure connection between a client, and a server, over
tcp/ip.  The clients will connect to my SSH server, and that will forward
them to another server, where an application exists.  The server is set up,
and the clients work if you use the various products out there like
SecureCRT.  But the challenge is to write our own code to run the commands
from the client, to the SSH server.  Heres where my lack of knowledge
becomes and obstacle.  If someone provided a .dll that did the commands to
the SSH server and encryption (and of corse provided the source, or at least
examples of how to call the .dll) then i would write an .exe to call the
 .dll and i'd be all set.  But all i found were shareware products and they
arent telling you how to call their .dll's and i dont know how to
dissassemble them etc...
I figure there is a perl module, that wraps the commands, but i am told that
that module will cause problems on the clients, because the clients are
WIN32, and the Modules contain some UNIX specific math functionality.  I did
download Net-SSH-Perl-1.20 anyway and im not that sure how to install it, or
if i need to install it, or simply unzip it.  there is a makefile.pl that
when i run it it asks me a buch of questions that i have no idea what its
asking (this is an unusual process for a windows person).
Anyway, some help on what direction to go in would be a great help.




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

Date: 24 Jul 2001 07:42:50 -0700
From: kevin@parr.net (Kevin der Kinderen)
Subject: Re: Upgrade Perl on RH7.1 From Source
Message-Id: <6e6452ff.0107240642.36153a58@posting.google.com>

Nope. That didn't do it. It actually caused a host of other problems
with dependencies in RH. For instance, I couldn't restart httpd
(apache). It was still looking for 5.6.0 modules.

So, my conclusion... If I want to play I need a linux system that's
not based on RPMs and such.

Thanks for the feedback I got by email.

Kevin


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

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


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