Re: uploading and downloading files to MySQL

2003-01-09 Thread R. Joseph Newton
Hi Marius,

Why do it?  Databases are designed for organization of large table and information 
about the relationships between theri attributes.  I would suggest going light, 
storing only the filename of an image in the db, and stroing the images files 
themselves as files.

Joseph

Mariusz wrote:

> Hi,
>
> I found some info on how to upload files into a directory on the server and I was 
>able to do that but can anyone tell me how to upload a file to my database (MySQL)? I 
>know to use BLOB for the field type (which BLOB depending on the size) but how do I 
>construct the INSERT or is there a different special sql command just for that?
> I will also need the visitor to be able to download that file and display in the 
>browser (in case of the pic) and download the other type of files (like music) 
>straight to his hard drive. Basically how can I let a visitor download the file from 
>my database?
>
> I'll also greatly appreciate any pointers to some articles on the net.
>
> thank you,
> Mariusz


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: check file existence

2003-01-09 Thread Ramprasad


Alex Cheung Tin Ka wrote:
> Dear All,
> I have a problem on using CGI to check the file existence in a directory. Here 
>is my code
> 
> $workDir = "/usr/local/home/tkcheung/systemadmin/singlesar/Report";
> $path = "tulisar030108.rpt";
> $notAvailabe = 0;
> $a = qq`$workDir/$path`;
> if (! -e $a){ $notAvailable = 1;}
> return $notAvailable;
> 
> The file does exist, but the code always return 1; 
> I do try to install the module Test::File (but failed) and using open file to 
>test the file existence ( it works)
> 
> I would ike to know how to use the "-e" to check it. 
> 
> Regards,
> Alex
> 


DO $a = "$workDir/$path";
instead of $a = qq`$workDir/$path`;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: File Handle?

2003-01-09 Thread Mark Goland
How about,

print "its a file handle\n" if ( fileno($FH) ); 

- Original Message - 
From: "Beau E. Cox" <[EMAIL PROTECTED]>
To: "'Beginners" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 11:43 PM
Subject: File Handle?


> Hi -
> 
> I want to determine is a variable is a file handle.
> 
> How would I do this?
> 
> I know how to tell if it is a ref to something,
> but I can't seem to be able to find out if it
> is a file handle.
> 
> Aloha => Beau/
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Looping through a Hash

2003-01-09 Thread Rob Dixon
Hi Colin

This does what you want:

while (($k, $v) = each %picDetails )
{
# do stuff to  $v;
}

Note that to modify the hash's copy of $v you would have to change
$picDetails{$k}.

HTH,

Rob


"Colin Johnstone" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Gidday All,
>
> Can I do this when looping through a Hash.
>
> foreach my($k, $v)( %picDetails ){
>   do stuff to  $v;
> }
>
> Thanking you in Anticipation
>
> Colin



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: check file existence

2003-01-09 Thread Rob Dixon
Hi Alex

It seems you have a typing error, see in-line. However I don't see how this
would cause your problem. I would make sure you have entered your path and
file name correctly. (How about copying and pasting directly from a
directory listing?)

Apart from that, how about writing your code as:

$workDir = "/usr/local/home/tkcheung/systemadmin/singlesar/Report";
$path = "tulisar030108.rpt";

return ! -e "$workDir/$path";

HTH,

Rob



"Alex Cheung Tin Ka" <[EMAIL PROTECTED]> wrote in message
021501c2b791$0c935bc0$[EMAIL PROTECTED]">news:021501c2b791$0c935bc0$[EMAIL PROTECTED]...
> Dear All,
> I have a problem on using CGI to check the file existence in a
directory. Here is my code
>
> $workDir = "/usr/local/home/tkcheung/systemadmin/singlesar/Report";
> $path = "tulisar030108.rpt";
> $notAvailabe = 0;

  

Appears below as $notAvailable.

> $a = qq`$workDir/$path`;
> if (! -e $a){ $notAvailable = 1;}
> return $notAvailable;
>
> The file does exist, but the code always return 1;
> I do try to install the module Test::File (but failed) and using open
file to test the file existence ( it works)
>
> I would ike to know how to use the "-e" to check it.
>
> Regards,
> Alex




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




hash & arrays

2003-01-09 Thread Jerry Preston
Hi!,

I do not understand what I am doing wrong.  I can pass an hash this way and
not an array using the following:

   require Exporter;

   our @ISA = qw(Exporter);
   our @EXPORT = qw();
   our @EXPORT_OK = qw( @T_AREA );
   our @EXPORT_OK = qw( %T_IDS );

where

  @T_AREA = ( "", "NORTH", "SOUTH" );

  %T_IDS = (
 NORTH=> [ qw/KT201 KT202 KT203 KT210 KT211 KT212 KT215
KT216 KT217 KT218 KT219 KT220 KT221/ ],

 SOUTH=> [ qw/PT211 PT212 PT213 PT214 PT215 PT216 PT217
PT218/ ],

  );


Why can I not export the array T_AREA ?

Thanks,

Jerry



CRLF vs LF questions

2003-01-09 Thread David Eason
Q1. For Windows, does anyone know of a Windows Explorer add-on that makes
Perl source files with CR-LF terminated lines appear in a different color or
something so I can easily see they need to be corrected?

Q2. Are there any Linux versions of Perl that "don't care" whether the
source file ends in CR-LF's or LF's? (Because the Windows version from
ActiveState doesn't seem to)




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Remove some, not all \n from a text block

2003-01-09 Thread Alan C.
Hello,

It's now a previously formatted text block with line breaks at every 70 
characters width.

And the block's first line begins with a leading period or dot as well 
as approximately every third line thereafter begins with a leading 
period or dot.

How do I rid the block of line breaks on every line except for the lines 
that begin with the leading period or dot?

I want to end up with a fewer number of lines whereby each of them is 
both longer and is preceded by the period or dot (sample output below).
--

#!/perl/bin/perl -w
undef $/;# Enter "file slurp" mode.
$text = <>;  # This file/selection slurped into the scalar
for ($text =~ s/\n\.//g) {
print $text;
}

I tried the above removes each \nPERIOD combo, not quite yet what I want.

I'm aware that split is an array but I don't yet know how to use split. 
 And I'm not sure if split is what is needed.

How to, using regex, split, or otherwise?
--

--begin test sample text block--
.WEDNESDAY...CLOUDY IN THE MORNING THEN BECOMING PARTLY CLOUDY.
AREAS OF DENSE FOG IN THE MORNING. HIGHS 56 TO 61. LIGHT WINDS.
.WEDNESDAY NIGHT...MOSTLY CLOUDY. PATCHY FOG OVERNIGHT. LOWS 41 TO
48. LIGHT WINDS.
.THURSDAY...MOSTLY CLOUDY. SLIGHT CHANCE OF SHOWERS IN THE
AFTERNOON. HIGHS 52 TO 57. SOUTHEAST WINDS 10 TO 15 MPH.
.THURSDAY NIGHT...MOSTLY CLOUDY.
--end test sample text block--

.WEDNESDAY really long line
.WEDNESDAY NIGHT really long line
.THURSDAY really long line

(my desired output)

--
Cheers!  Alan.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: check file existence

2003-01-09 Thread Vitaliy Babiy
Try this

unless  (-f $a) { $notAvialible = 1 }

=
"Alex Cheung Tin Ka" <[EMAIL PROTECTED]> wrote in message
021501c2b791$0c935bc0$[EMAIL PROTECTED]">news:021501c2b791$0c935bc0$[EMAIL PROTECTED]...
Dear All,
I have a problem on using CGI to check the file existence in a
directory. Here is my code

$workDir = "/usr/local/home/tkcheung/systemadmin/singlesar/Report";
$path = "tulisar030108.rpt";
$notAvailabe = 0;
$a = qq`$workDir/$path`;
if (! -e $a){ $notAvailable = 1;}
return $notAvailable;

The file does exist, but the code always return 1;
I do try to install the module Test::File (but failed) and using open
file to test the file existence ( it works)

I would ike to know how to use the "-e" to check it.

Regards,
Alex




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: check file existence

2003-01-09 Thread LaVei
Alex Cheung Tin Ka wrote:
> 
> Dear All,
> I have a problem on using CGI to check the file existence in a directory. Here 
>is my code
> 
> $workDir = "/usr/local/home/tkcheung/systemadmin/singlesar/Report";
> $path = "tulisar030108.rpt";
> $notAvailabe = 0; ### Must be named $notAvailable :-)

> $a = qq`$workDir/$path`;
> if (! -e $a){ $notAvailable = 1;}
> return $notAvailable;
> 
> The file does exist, but the code always return 1;
> I do try to install the module Test::File (but failed) and using open file to 
>test the file existence ( it works)
> 
> I would ike to know how to use the "-e" to check it.
> 
> Regards,
> Alex
> 

use strict in next time.:-)

-- 

LaVei

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: uploading and downloading files to MySQL

2003-01-09 Thread Vitaliy Babiy
I don't think it's  good idea to store files in DB. Especially big files
like music...
The common way is to store path_to_files in DB




"Mariusz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi,

I found some info on how to upload files into a directory on the server and
I was able to do that but can anyone tell me how to upload a file to my
database (MySQL)? I know to use BLOB for the field type (which BLOB
depending on the size) but how do I construct the INSERT or is there a
different special sql command just for that?
I will also need the visitor to be able to download that file and display in
the browser (in case of the pic) and download the other type of files (like
music) straight to his hard drive. Basically how can I let a visitor
download the file from my database?

I'll also greatly appreciate any pointers to some articles on the net.

thank you,
Mariusz





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Compariing Apples and Oranges?

2003-01-09 Thread Bob Williams
List 1 is the control list containing: Apple, Orange, Lemon, Tangerine, and Grape. 
List 2 contains Apple, Tangerine, Grape, and Banana.

I need a script that compares the two lists and will eliminate banana from list 2 
because banana is not in the control List 1. The script will not add Orange to List 2 
even tho it is in the Control List 1. 

Perhaps the script would create list 3 with the results (Apple, Tangerine, and Grape)?

Thanks

Bob Williams




 


Re: References ch 8 programming Perl

2003-01-09 Thread Randal L. Schwartz
> "John" == John W Krahn <[EMAIL PROTECTED]> writes:

John> "Randal L. Schwartz" wrote:
>> 
>> (In the past week, I just finished writing this stuff up for my next
>> book... see the bookshelves in six months or so.)

John> Does it have a title yet?  Will there be an animal on the cover?  :-)

No.  Probably.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Comparing Apples and Oranges

2003-01-09 Thread Bob Williams
I have two lists.

List 1 is the control list containing: Apple, Orange, Lemon, Tangerine, and Grape. 
List 2 contains Apple, Tangerine, Grape, and Banana.

I need a script that compares the two lists and will eliminate banana from list 2 
because banana is not in the control List 1. The script will not add Orange to List 2 
even tho it is in the Control List 1. 

Perhaps the script would create list 3 with the results (Apple, Tangerine, and Grape)?

Thanks

Bob Williams


Weekly list FAQ posting

2003-01-09 Thread casey
NAME
beginners-faq - FAQ for the beginners mailing list

1 -  Administriva
  1.1 - I'm not subscribed - how do I subscribe?

Send mail to <[EMAIL PROTECTED]>

You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):

<[EMAIL PROTECTED]>.

  1.2 -  How do I unsubscribe?

Now, why would you want to do that? Send mail to
<[EMAIL PROTECTED]>, and wait for a response. Once you
reply to the response, you'll be unsubscribed. If that doesn't work,
find the email address which you are subscribed from and send an email
like the following (let's assume your email is [EMAIL PROTECTED]):

<[EMAIL PROTECTED]>

  1.3 - There is too much traffic on this list. Is there a digest?

Yes. To subscribe to the digest version of this list send an email to:

<[EMAIL PROTECTED]>

To unsubscribe from the digest, send an email to:

<[EMAIL PROTECTED]>

This is a high traffic list (100+ messages per day), so please subscribe
in the way which is best for you.

  1.4 - Is there an archive on the web?

Yes, there is. It is located at:

http://archive.develooper.com/beginners%40perl.org/

  1.5 - How can I get this FAQ?

This document will be emailed to the list once a week, and will be
available online in the archives, and at http://learn.perl.org/

  1.6 - I don't see something in the FAQ, how can I make a suggestion?

Send an email to <[EMAIL PROTECTED]> with your suggestion.

  1.7 - Is there a supporting website for this list?

Yes, there is. It is located at:

http://beginners.perl.org/

  1.8 - Who owns this list?  Who do I complain to?

Casey West owns the beginners list. You can contact him at
[EMAIL PROTECTED]

  1.9 - Who currently maintains the FAQ?

Kevin Meltzer, who can be reached at the email address (for FAQ
suggestions only) in question 1.6

  1.10 - Who will maintain peace and flow on the list?

Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large,
yet padded, clue-sticks to maintain peace and order on the list. If you
are privately emailed by one of these folks for flaming, being
off-topic, etc... please listen to what they say. If you see a message
sent to the list by one of these people saying that a thread is closed,
do not continue to post to the list on that thread! If you do, you will
not only meet face to face with a XQJ-37 nuclear powered pansexual
roto-plooker, but you may also be taken off of the list. These people
simply want to make sure the list stays topical, and above-all, useful
to Perl beginners.

  1.11 - When was this FAQ last updated?

Sept 07, 2001

2 -  Questions about the 'beginners' list.
  2.1 - What is the list for?

A list for beginning Perl programmers to ask questions in a friendly
atmosphere.

  2.2 - What is this list _not_ for?

* SPAM
* Homework
* Solicitation
* Things that aren't Perl related
* Monkeys
* Monkeys solicitating homework on non-Perl related SPAM.
  2.3 - Are there any rules?

Yes. As with most communities, there are rules. Not many, and ones that
shouldn't need to be mentioned, but they are.

* Be nice
* No flaming
* Have fun
  2.4 - What topics are allowed on this list?

Basically, if it has to do with Perl, then it is allowed. You can ask
CGI, networking, syntax, style, etc... types of questions. If your
question has nothing at all to do with Perl, it will likely be ignored.
If it has anything to do with Perl, it will likely be answered.

  2.5 - I want to help, what should I do?

Subscribe to the list! If you see a question which you can give an
idiomatic and Good answer to, answer away! If you do not know the
answer, wait for someone to answer, and learn a little.

  2.6 - Is there anything I should keep in mind while answering?

We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the
beginner to the place in the FM they should R :)

Please do not quote the documentation unless you have something to add
to it. It is better to direct someone to the documentation so they
hopefully will read documentation above and beyond that which answers
their question. It also helps teach them how to use the documentation.

  2.7 - I don't want to post a question if it is in an FAQ. Where should I
look first?

Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it.
It can save everyone time if you look in the Perl FAQs first, instead of
having a list of people refer you to the Perl FAQs :) You can learn
about 'perldoc' by typing:

"perldoc perldoc"

At your command prompt. You can also view documentation online at:

http://www.perldoc.com and http://www.perl.com

  2.8 Is this a high traffic list?

YES! You have been warned! If you don't want to get ~100 emails per day
from this

Re: Comparing Apples and Oranges

2003-01-09 Thread Sudarshan Raghavan
Bob Williams wrote:


I have two lists.

List 1 is the control list containing: Apple, Orange, Lemon, Tangerine, and Grape. 
List 2 contains Apple, Tangerine, Grape, and Banana.

I need a script that compares the two lists and will eliminate banana from list 2 because banana is not in the control List 1. The script will not add Orange to List 2 even tho it is in the Control List 1. 

Perhaps the script would create list 3 with the results (Apple, Tangerine, and Grape)?

Thanks

Bob Williams


perldoc -q intersection





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Comparing Apples and Oranges

2003-01-09 Thread NYIMI Jose (BMB)
C:\>perldoc -q intersection
Found in C:\Perl\lib\pod\perlfaq4.pod
  How do I compute the difference of two arrays?  How do I compute the
intersect
ion of two arrays?

Use a hash. Here's code to do both and more. It assumes that
each element is unique in a given array:

@union = @intersection = @difference = ();
%count = ();
foreach $element (@array1, @array2) { $count{$element}++
}
foreach $element (keys %count) {
push @union, $element;
push @{ $count{$element} > 1 ? \@intersection :
\@difference
 }, $element;
}

Note that this is the *symmetric difference*, that is, all
elements in either A or in B but not in both. Think of it as
an
xor operation.


C:\>

> -Original Message-
> From: Bob Williams [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 09, 2003 2:02 PM
> To: [EMAIL PROTECTED]
> Subject: Comparing Apples and Oranges
> 
> 
> I have two lists.
> 
> List 1 is the control list containing: Apple, Orange, Lemon, 
> Tangerine, and Grape. 
> List 2 contains Apple, Tangerine, Grape, and Banana.
> 
> I need a script that compares the two lists and will 
> eliminate banana from list 2 because banana is not in the 
> control List 1. The script will not add Orange to List 2 even 
> tho it is in the Control List 1. 
> 
> Perhaps the script would create list 3 with the results 
> (Apple, Tangerine, and Grape)?
> 
> Thanks
> 
> Bob Williams
> 


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: File Handle?

2003-01-09 Thread wiggins

On Thu, 09 Jan 2003 06:36:25 -0500, Mark Goland <[EMAIL PROTECTED]> wrote:

> How about,
> 
> print "its a file handle\n" if ( fileno($FH) ); 
> 

This will only work if the fileno is not 0, and STDIN's fileno is 0. Could be a 
problem if looking for something that could hold STDIN or if something has redirected 
STDIN internally.  To be safe stick with the ref == GLOB approach, though that might 
return true on things other than file handles, not sure.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: hash & arrays

2003-01-09 Thread wiggins
You are resetting (clearing) @EXPORT_OK. Either you need to set it all at once or push 
to it (though I don't know if this latter works, should). See inline.



On Thu, 9 Jan 2003 06:26:01 -0600, "Jerry Preston" <[EMAIL PROTECTED]> wrote:

> Hi!,
> 
> I do not understand what I am doing wrong.  I can pass an hash this way and
> not an array using the following:
> 
>require Exporter;
> 
>our @ISA = qw(Exporter);
>our @EXPORT = qw();
>our @EXPORT_OK = qw( @T_AREA );
>our @EXPORT_OK = qw( %T_IDS );

The above line clears and then reassigns @EXPORT_OK, strict/warnings would have yelled 
at you about the same declaration in the same scope, blah blah...better written as:

our @EXPORT_OK = qw ( @T_AREA %T_IDS );

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CRLF vs LF questions

2003-01-09 Thread Jenda Krynicky
From: "David Eason" <[EMAIL PROTECTED]>
> Q1. For Windows, does anyone know of a Windows Explorer add-on that
> makes Perl source files with CR-LF terminated lines appear in a
> different color or something so I can easily see they need to be
> corrected?

I doubt anything like this does (or ever will) exist.
 
> Q2. Are there any Linux versions of Perl that "don't care" whether the
> source file ends in CR-LF's or LF's? (Because the Windows version from
> ActiveState doesn't seem to)

Any recent version of Perl should not care (almost) whether there are 
CRLFs or LFs. You might have problems with heredocs and the multiline 
string constants may contain CRLF, but that's about it.

Anyway, we are all Perl programmers here. It should not be a big 
problem to create a script that'll convert all files that need it. Or 
even automate the upload of the files.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Remove some, not all \n from a text block

2003-01-09 Thread John W. Krahn
"Alan C." wrote:
> 
> Hello,

Hello,

> It's now a previously formatted text block with line breaks at every 70
> characters width.
> 
> And the block's first line begins with a leading period or dot as well
> as approximately every third line thereafter begins with a leading
> period or dot.
> 
> How do I rid the block of line breaks on every line except for the lines
> that begin with the leading period or dot?
> 
> I want to end up with a fewer number of lines whereby each of them is
> both longer and is preceded by the period or dot (sample output below).
> --
> 
> #!/perl/bin/perl -w
> undef $/;# Enter "file slurp" mode.
> $text = <>;  # This file/selection slurped into the scalar
> for ($text =~ s/\n\.//g) {
> print $text;
> }
> 
> I tried the above removes each \nPERIOD combo, not quite yet what I want.
> 
> I'm aware that split is an array but I don't yet know how to use split.
>   And I'm not sure if split is what is needed.
> 
> How to, using regex, split, or otherwise?

Here is one way to do it:

#!/perl/bin/perl -w
use strict;

my $text = do { local $/; <> };
$text =~ s/\n(?!\.|\z)/ /g;
print $text;

__END__



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: hash & arrays

2003-01-09 Thread Jenda Krynicky
From: "Jerry Preston" <[EMAIL PROTECTED]>
> I do not understand what I am doing wrong.  I can pass an hash this
> way and not an array using the following:
> 
>require Exporter;
> 
>our @ISA = qw(Exporter);
>our @EXPORT = qw();
>our @EXPORT_OK = qw( @T_AREA );
>our @EXPORT_OK = qw( %T_IDS );

Erm.. would you expect at the end of this
$x = 5;
$x = 10;
the $x to contain BOTH 5 and 10?

First you set the list of things to export optionaly to
( '@T_AREA' )
and then to
( '%T_IDS' )
you can't expect Perl to know you reall wanted to set it to
( '@T_AREA', '%T_IDS' )

Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Remove some, not all \n from a text block

2003-01-09 Thread Rob Dixon
Hi Alan

How about:

my $last = undef;

while (<>)
{
next unless defined $last;
chomp $last unless /^\./;
print $last;
} continue {
$last = $_;
}

print $last;

HTH,

Rob

"Alan C." <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> It's now a previously formatted text block with line breaks at every 70
> characters width.
>
> And the block's first line begins with a leading period or dot as well
> as approximately every third line thereafter begins with a leading
> period or dot.
>
> How do I rid the block of line breaks on every line except for the lines
> that begin with the leading period or dot?
>
> I want to end up with a fewer number of lines whereby each of them is
> both longer and is preceded by the period or dot (sample output below).
> --
>
> #!/perl/bin/perl -w
> undef $/;# Enter "file slurp" mode.
> $text = <>;  # This file/selection slurped into the scalar
> for ($text =~ s/\n\.//g) {
> print $text;
> }
>
> I tried the above removes each \nPERIOD combo, not quite yet what I want.
>
> I'm aware that split is an array but I don't yet know how to use split.
>   And I'm not sure if split is what is needed.
>
> How to, using regex, split, or otherwise?
> --
>
> --begin test sample text block--
> .WEDNESDAY...CLOUDY IN THE MORNING THEN BECOMING PARTLY CLOUDY.
> AREAS OF DENSE FOG IN THE MORNING. HIGHS 56 TO 61. LIGHT WINDS.
> .WEDNESDAY NIGHT...MOSTLY CLOUDY. PATCHY FOG OVERNIGHT. LOWS 41 TO
> 48. LIGHT WINDS.
> .THURSDAY...MOSTLY CLOUDY. SLIGHT CHANCE OF SHOWERS IN THE
> AFTERNOON. HIGHS 52 TO 57. SOUTHEAST WINDS 10 TO 15 MPH.
> .THURSDAY NIGHT...MOSTLY CLOUDY.
> --end test sample text block--
>
> .WEDNESDAY really long line
> .WEDNESDAY NIGHT really long line
> .THURSDAY really long line
>
> (my desired output)
>
> --
> Cheers!  Alan.
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CRLF vs LF questions

2003-01-09 Thread Rob Dixon
David

Re Q1. Get yourself a copy of TextPad http://www.textpad.com/ which will
handle any of ANSI, DOS, Unicode or UTF-8 encoding. It identifies the
encoding automatically fromt he contents and allows you to change it using
Save As...

HTH,

Rob


"David Eason" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Q1. For Windows, does anyone know of a Windows Explorer add-on that makes
> Perl source files with CR-LF terminated lines appear in a different color
or
> something so I can easily see they need to be corrected?
>
> Q2. Are there any Linux versions of Perl that "don't care" whether the
> source file ends in CR-LF's or LF's? (Because the Windows version from
> ActiveState doesn't seem to)
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Comparing Apples and Oranges

2003-01-09 Thread Rob Dixon
Hi Bob

In general a hash is the way to go:

my @list1 = qw ( Apple Orange Lemon Tangerine Grape );
my @list2 = qw( Apple Tangerine Grape Banana );

my %list1 = map {($_ => 1) } @list1;
my @list3 = grep {$list1{$_}} @list2;

print "@list3";

output:

Apple Tangerine Grape

HTH,

Rob




"Bob Williams" <[EMAIL PROTECTED]> wrote in message
003101c2b7df$59f7d780$[EMAIL PROTECTED]">news:003101c2b7df$59f7d780$[EMAIL PROTECTED]...
I have two lists.

List 1 is the control list containing: Apple, Orange, Lemon, Tangerine, and
Grape.
List 2 contains Apple, Tangerine, Grape, and Banana.

I need a script that compares the two lists and will eliminate banana from
list 2 because banana is not in the control List 1. The script will not add
Orange to List 2 even tho it is in the Control List 1.

Perhaps the script would create list 3 with the results (Apple, Tangerine,
and Grape)?

Thanks

Bob Williams



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: File Handle?

2003-01-09 Thread Rob Dixon

print "its a file handle\n" if ( defined fileno($FH) );

/R

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 
> On Thu, 09 Jan 2003 06:36:25 -0500, Mark Goland <[EMAIL PROTECTED]>
wrote:
>
> > How about,
> >
> > print "its a file handle\n" if ( fileno($FH) );
> >
>
> This will only work if the fileno is not 0, and STDIN's fileno is 0. Could
be a problem if looking for something that could hold STDIN or if something
has redirected STDIN internally.  To be safe stick with the ref == GLOB
approach, though that might return true on things other than file handles,
not sure.
>
> http://danconia.org



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: File Handle?

2003-01-09 Thread Bob Showalter
Beau E. Cox wrote:
> Hi -
> 
> I want to determine is a variable is a file handle.
> 
> How would I do this?
> 
> I know how to tell if it is a ref to something,
> but I can't seem to be able to find out if it
> is a file handle.
> 
> Aloha => Beau/

UNIVERSAL::isa($var, 'GLOB') should do the trick. This works for IO::File
and similar objects as well as those created by open(my $fh, ...).

If you want to see if a file is actually open on that handle, you can do
something like:

UNIVERSAL::isa($var, 'GLOB') && eval { $var->opened }

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: "hidden" characters in an input stream

2003-01-09 Thread Jason Frisvold
This helped out considerably!  I found that there are 3 CR's at the
beginning of each line..  stripping these out makes it all work
perfectly :)

Thanks,

On Wed, 2003-01-08 at 10:44, Christopher Kruslicky wrote:
> On Wednesday 08 January 2003 3:11 pm, Jason Frisvold wrote:
> > This works great :)
> >
> > Still curious what's in that line, but ...
> >
> > Is there a way to show the raw output?
> >
> 
> 
> a very good and useful idea :)  it's a regex that matches from ' ' thru '~', 
> which according to the ascii chart are the first and last printable 
> characters:
> 
> | 00 nul| 01 soh| 02 stx| 03 etx| 04 eot| 05 enq| 06 ack| 07 bel|
> | 08 bs | 09 ht | 0a nl | 0b vt | 0c np | 0d cr | 0e so | 0f si |
> | 10 dle| 11 dc1| 12 dc2| 13 dc3| 14 dc4| 15 nak| 16 syn| 17 etb|
> | 18 can| 19 em | 1a sub| 1b esc| 1c fs | 1d gs | 1e rs | 1f us |
> | 20 sp | 21  ! | 22  " | 23  # | 24  $ | 25  % | 26  & | 27  ' |
> | 28  ( | 29  ) | 2a  * | 2b  + | 2c  , | 2d  - | 2e  . | 2f  / |
> | 30  0 | 31  1 | 32  2 | 33  3 | 34  4 | 35  5 | 36  6 | 37  7 |
> | 38  8 | 39  9 | 3a  : | 3b  ; | 3c  < | 3d  = | 3e  > | 3f  ? |
> | 40  @ | 41  A | 42  B | 43  C | 44  D | 45  E | 46  F | 47  G |
> | 48  H | 49  I | 4a  J | 4b  K | 4c  L | 4d  M | 4e  N | 4f  O |
> | 50  P | 51  Q | 52  R | 53  S | 54  T | 55  U | 56  V | 57  W |
> | 58  X | 59  Y | 5a  Z | 5b  [ | 5c  \ | 5d  ] | 5e  ^ | 5f  _ |
> | 60  ` | 61  a | 62  b | 63  c | 64  d | 65  e | 66  f | 67  g |
> | 68  h | 69  i | 6a  j | 6b  k | 6c  l | 6d  m | 6e  n | 6f  o |
> | 70  p | 71  q | 72  r | 73  s | 74  t | 75  u | 76  v | 77  w |
> | 78  x | 79  y | 7a  z | 7b  { | 7c  | | 7d  } | 7e  ~ | 7f del|
> 
> 
> to show raw output, compare these:
> $ perl -e '$tmp=sprintf "%s", "123"; print "...$tmp...\n";'
> ...123...
> $ perl -e '$tmp=sprintf "%vx", "123"; print "...$tmp...\n";'
> ...31.32.33...
> 
> in %vd, 'v' is perl-specific, in this case outputting the ascii value of 
> each character in the string.  Note the values are in hex to match the 
> ascii chart above.
> 
> 
> 
> > On Wed, 2003-01-08 at 14:52, John W. Krahn wrote:
> > > Jason Frisvold wrote:
> > > > Hi all,
> > >
> > > Hello,
> > >
> > > > I'm using the Net::Telnet module to automate some of the more
> > > > menial tasks I have to deal with every so often.  Part of the task
> > > > requires parsing a stream of data from the device I'm telnetting to
> > > > (A Marconi ASX-200 to be exact) ...  I've successfully set up the
> > > > telnet, logged in, and executed the proper commands.  Now, however, I
> > > > need to retrieve data from the device.  I can submit the command and
> > > > use getline() to retrieve lines, one at a time, and parse it. 
> > > > However, there are "hidden" characters here and I don't know how to
> > > > determine what they are.
> > > >
> > > > Here is a quick snippet of the code :
> > > >
> > > > $Telnet->print("sec log sho");
> > > > while (my $line = $Telnet->getline(Timeout => 5,)) {
> > > > chomp $line;
> > >
> > > Instead of chomp (because this will remove newlines as well) use this:
> > >
> > > # remove every character NOT in the range ' ' to '~' inclusive
> > > $line =~ s/[^ -~]+//g;
> > >
> > > > print "---$line---\n";
> > > > }
> > >
> > > John
> > > --
> > > use Perl;
> > > program
> > > fulfillment
-- 
---
Jason H. Frisvold
Backbone Engineer
Penteledata Engineering
[EMAIL PROTECTED]
RedHat Certified - RHCE # 807302349405893
---
"Something mysterious is formed, born in the silent void. Waiting alone
and unmoving, it is at once still and yet in constant motion. It is the
source of all programs. I do not know its name, so I will call it the
Tao of Programming."



signature.asc
Description: This is a digitally signed message part


bandwidth restricting

2003-01-09 Thread mod_perl
hi all,
   In my Lan I have a linux proxy .How  can i restrict the bandwidth
cosumed by each user using perl .Which module i can use .
   thanks in advance

shine


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Creating Modules

2003-01-09 Thread anthony
Hello,

I was wondering if someone could give me a link where i can learn how to
construct Modules.

Thank



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Creating Modules

2003-01-09 Thread Rob Dixon
Hi Anthony

Try

perldoc perlmod

and

perldoc perlmodlib

Cheers,

Rob

"Anthony" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I was wondering if someone could give me a link where i can learn how to
> construct Modules.
>
> Thank
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




regular expressions

2003-01-09 Thread Kehayias, Evan N Mr NISO/Lockheed Martin
Greetings,

I am attempting to limit entries a user could make when inputting names into
one of my scripts.  I prompt the user to enter one or more names.  One name
is easy to isolate but when there are more I want to support commas.  At the
same time I don't want to accept anything other than names and commas.  I
want to force the user to either enter names correctly or exit.  For that
matter it would be really cool if I could test the names against
/etc/passwd.  But beggars can't be choosers I will tackle the array piece
later. 

What the user sees:

Please enter user name(s):
If more than one separate using commas
example (single name): evan
example (multi name): debbie, clint, henry



So far what broken pieces I have...

#!/usr/bin/perl


while($ans !~ /^[a-z]+$/ || $ans !~ /^[a-z]+\,?[a-z]*$/) {
  errmesg ();
  $ans = ;

};

sub errmesg {
  print "\nType user name(s) and press enter:\n";
  print "note: if more than one separate using commas\n";
  print "example (single name): evan\n";
  print "example (multi name): debbie, clint, henry\n";
}



Re: regular expressions

2003-01-09 Thread Rob Dixon
Hello, erm, "Evan N Mr Niso/Lockheed Martin Kehayias"

This should do what you want:


my @names;
do {
errmesg() if @names;
my $ans = ;
@names = split /\s*,\s*/, $ans;
} while (grep {/[^a-zA-Z]/} @names);

which splits on commas with any amount of preceding and trailing whitespace.
Names have to be alphabetic.

HTH,

Rob


"Evan N Mr Niso/Lockheed Martin Kehayias" <[EMAIL PROTECTED]> wrote
in message 90AFE0B84E52EE46A8CD1DB0789C0A860ED043@DADC144">news:90AFE0B84E52EE46A8CD1DB0789C0A860ED043@DADC144...
> Greetings,
>
> I am attempting to limit entries a user could make when inputting names
into
> one of my scripts.  I prompt the user to enter one or more names.  One
name
> is easy to isolate but when there are more I want to support commas.  At
the
> same time I don't want to accept anything other than names and commas.  I
> want to force the user to either enter names correctly or exit.  For that
> matter it would be really cool if I could test the names against
> /etc/passwd.  But beggars can't be choosers I will tackle the array piece
> later.
>
> What the user sees:
>
> Please enter user name(s):
> If more than one separate using commas
> example (single name): evan
> example (multi name): debbie, clint, henry
>
>
>
> So far what broken pieces I have...
>
> #!/usr/bin/perl
>
>
> while($ans !~ /^[a-z]+$/ || $ans !~ /^[a-z]+\,?[a-z]*$/) {
>   errmesg ();
>   $ans = ;
>
> };
>
> sub errmesg {
>   print "\nType user name(s) and press enter:\n";
>   print "note: if more than one separate using commas\n";
>   print "example (single name): evan\n";
>   print "example (multi name): debbie, clint, henry\n";
> }
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Delimiter Question

2003-01-09 Thread Vuctor Akinnagbe
How do I challenege more than one variable like I want to check for the input of Y N y 
or n for a yes no question. I put until $answer =~ m/YyNn/ that did not work. Anybody 
have any solutions?


-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


Re: Delimiter Question

2003-01-09 Thread Rob Dixon

$answer =~ m/^[YyNn]/;

/R

"Vuctor Akinnagbe" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> How do I challenege more than one variable like I want to check for the
input of Y N y or n for a yes no question. I put until $answer =~ m/YyNn/
that did not work. Anybody have any solutions?
>
>
> -
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Delimiter Question

2003-01-09 Thread Paul Kraus
I think you mean $answer m/[YyNn]/

yours is looking for $answer to contain "YyNn"
the brackets mean any one of the following.

> -Original Message-
> From: Vuctor Akinnagbe [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 09, 2003 10:11 AM
> To: [EMAIL PROTECTED]
> Subject: Delimiter Question
> 
> 
> How do I challenege more than one variable like I want to 
> check for the input of Y N y or n for a yes no question. I 
> put until $answer =~ m/YyNn/ that did not work. Anybody have 
> any solutions?
> 
> 
> -
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: regular expressions

2003-01-09 Thread Paul Kraus
Correct me if I am wrong but wouldn't 
@names = sprit /,/,$ans;
Then you could perform your tests against the array elements.
if (/[A-Za-z]+/)
Assuming that the names would only contain those characters.

or if (/\w+/) meaning all word characters.

Do the same thing. Splitting everything separated by a comma?

> -Original Message-
> From: Rob Dixon [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 09, 2003 10:06 AM
> To: [EMAIL PROTECTED]
> Subject: Re: regular expressions
> 
> 
> Hello, erm, "Evan N Mr Niso/Lockheed Martin Kehayias"
> 
> This should do what you want:
> 
> 
> my @names;
> do {
> errmesg() if @names;
> my $ans = ;
> @names = split /\s*,\s*/, $ans;
> } while (grep {/[^a-zA-Z]/} @names);
> 
> which splits on commas with any amount of preceding and 
> trailing whitespace. Names have to be alphabetic.
> 
> HTH,
> 
> Rob
> 
> 
> "Evan N Mr Niso/Lockheed Martin Kehayias" 
> <[EMAIL PROTECTED]> wrote in message 
> 90AFE0B84E52EE46A8CD1DB0789C0A860ED043@DADC144">news:90AFE0B84E52EE46A8CD1DB0789C0A860ED043@DADC144...
> > Greetings,
> >
> > I am attempting to limit entries a user could make when inputting 
> > names
> into
> > one of my scripts.  I prompt the user to enter one or more 
> names.  One
> name
> > is easy to isolate but when there are more I want to 
> support commas.  
> > At
> the
> > same time I don't want to accept anything other than names 
> and commas.  
> > I want to force the user to either enter names correctly or 
> exit.  For 
> > that matter it would be really cool if I could test the 
> names against 
> > /etc/passwd.  But beggars can't be choosers I will tackle the array 
> > piece later.
> >
> > What the user sees:
> >
> > Please enter user name(s):
> > If more than one separate using commas
> > example (single name): evan
> > example (multi name): debbie, clint, henry
> >
> >
> >
> > So far what broken pieces I have...
> >
> > #!/usr/bin/perl
> >
> >
> > while($ans !~ /^[a-z]+$/ || $ans !~ /^[a-z]+\,?[a-z]*$/) {
> >   errmesg ();
> >   $ans = ;
> >
> > };
> >
> > sub errmesg {
> >   print "\nType user name(s) and press enter:\n";
> >   print "note: if more than one separate using commas\n";
> >   print "example (single name): evan\n";
> >   print "example (multi name): debbie, clint, henry\n";
> > }
> >
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: regular expressions

2003-01-09 Thread Rob Dixon
Hi Paul

See below.

"Paul Kraus" <[EMAIL PROTECTED]> wrote in message
021b01c2b7f3$490ed540$64fea8c0@pkrausxp">news:021b01c2b7f3$490ed540$64fea8c0@pkrausxp...
> Correct me if I am wrong but wouldn't
> @names = sprit /,/,$ans;

That's pretty much what I did, except that I added optional leading and
trailing whitespace to the regex so that these would be trimmed from the
names. I didn't actually do the job properly though, because whitespace at
the start and end of $ans won't be removed, and input like '   Henrietta'
will fail. Nearly right though!

> Then you could perform your tests against the array elements.
> if (/[A-Za-z]+/)

Not really. That only checks to see if the name contains at least one alpha.
I did {/[^a-zA-Z]/ which checks for at least one non-alpha, when the loop
continues and reports an error. Also you don't need the '+' modifier.

> Assuming that the names would only contain those characters.
>
> or if (/\w+/) meaning all word characters.

/\W/ would do in my code, but its unwholesome inclusion of the underscore in
a valid 'word' character makes it much less useful for non-programming apps.

>
> Do the same thing. Splitting everything separated by a comma?

Unsure what you mean here :-? I'll pretend you didn't say it.

Cheers,

Rob

>
> > -Original Message-
> > From: Rob Dixon [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 09, 2003 10:06 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: regular expressions
> >
> >
> > Hello, erm, "Evan N Mr Niso/Lockheed Martin Kehayias"
> >
> > This should do what you want:
> >
> >
> > my @names;
> > do {
> > errmesg() if @names;
> > my $ans = ;
> > @names = split /\s*,\s*/, $ans;
> > } while (grep {/[^a-zA-Z]/} @names);
> >
> > which splits on commas with any amount of preceding and
> > trailing whitespace. Names have to be alphabetic.
> >
> > HTH,
> >
> > Rob
> >
> >
> > "Evan N Mr Niso/Lockheed Martin Kehayias"
> > <[EMAIL PROTECTED]> wrote in message
> > 90AFE0B84E52EE46A8CD1DB0789C0A860ED043@DADC144">news:90AFE0B84E52EE46A8CD1DB0789C0A860ED043@DADC144...
> > > Greetings,
> > >
> > > I am attempting to limit entries a user could make when inputting
> > > names
> > into
> > > one of my scripts.  I prompt the user to enter one or more
> > names.  One
> > name
> > > is easy to isolate but when there are more I want to
> > support commas.
> > > At
> > the
> > > same time I don't want to accept anything other than names
> > and commas.
> > > I want to force the user to either enter names correctly or
> > exit.  For
> > > that matter it would be really cool if I could test the
> > names against
> > > /etc/passwd.  But beggars can't be choosers I will tackle the array
> > > piece later.
> > >
> > > What the user sees:
> > >
> > > Please enter user name(s):
> > > If more than one separate using commas
> > > example (single name): evan
> > > example (multi name): debbie, clint, henry
> > >
> > >
> > >
> > > So far what broken pieces I have...
> > >
> > > #!/usr/bin/perl
> > >
> > >
> > > while($ans !~ /^[a-z]+$/ || $ans !~ /^[a-z]+\,?[a-z]*$/) {
> > >   errmesg ();
> > >   $ans = ;
> > >
> > > };
> > >
> > > sub errmesg {
> > >   print "\nType user name(s) and press enter:\n";
> > >   print "note: if more than one separate using commas\n";
> > >   print "example (single name): evan\n";
> > >   print "example (multi name): debbie, clint, henry\n";
> > > }
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Rob Dixon
Hi John, all

"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> [ top-posting fixed ]

I'm wondering how much of an error, if any, people think this is? I
personally choose to top-post so that anybody reading through a thread won't
have to page to the end of each post to get to new content. Also end-posting
can be missed by those who don't think to look there! I can find nothing in
the group guidelines to support either method.

I'd like to do what people prefer so, comments please...?

Thanks,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: length of hash name

2003-01-09 Thread Rob Dixon
Hi Dan

Guessing:

Unless there is a fixed limit, which I don't think there is, I imagine
identifiers are held inside Perl as a C string, which is null-terminated and
therefore of any length supportable by the hardware. I doubt if it will
cause you problems. Is this of real concern to you? Are you writing a Perl
generator or something?

Cheers,

Rob

"Dan Muey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Anybody happen to know off the top of their head what the max length of
characters is that a hash's name can be?

EG ::

%123456789 = (); is a nine charcter name
%joe_mama_said_to_tell_you_hi = (); is a 28 character name
etc..

Thanks

Dan






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Looping through a Hash

2003-01-09 Thread Timothy Johnson

The only time the foreach makes more sense (other than as a matter of
preference) is if you want to sort your keys or values.

e.g. 
foreach(sort keys %hash){
   print "$_ => $hash{$_}\n";
}

foreach(sort {$hash{$a} cmp $hash{$b}} keys(%hash)){
   print "$_ => $hash{$_}\n";
}

-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 4:32 PM
To: Johnstone, Colin
Cc: '[EMAIL PROTECTED]'
Subject: Re: Looping through a Hash


Sort of

foreach my $key (keys(%picDetails)) {
   my $val = $picDetails{$key};
   # do stuff to val
}

or

while (my ($key, $val) = each (%picDetails)) {
   # do stuff to key or val
}
(foreach may work here as well, but I have always preferred while's for 
some reason)

perldoc -f each
perldoc -f keys
perldoc -f values

http://danconia.org

Johnstone, Colin wrote:
> Gidday All,
> 
> Can I do this when looping through a Hash.
> 
> foreach my($k, $v)( %picDetails ){
>   do stuff to  $v;
> }
> 
> Thanking you in Anticipation
>  
> Colin
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Michael Weber
Give me top-posting any day!  I can sort by thread and read an entire
discussion without paging down once.

Personal preference, of course.

-Michael

>>> "Rob Dixon" <[EMAIL PROTECTED]> 01/09/03 09:52AM >>>
Hi John, all

"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> [ top-posting fixed ]

I'm wondering how much of an error, if any, people think this is? I
personally choose to top-post so that anybody reading through a thread
won't
have to page to the end of each post to get to new content. Also
end-posting
can be missed by those who don't think to look there! I can find
nothing in
the group guidelines to support either method.

I'd like to do what people prefer so, comments please...?

Thanks,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Module import error

2003-01-09 Thread Dylan Boudreau
I am trying to use seek from Fcntl and am getting the following errors
when I try and run the program.

"seek" is not defined in %Fcntl::EXPORT_TAGS at
/usr/perl5/5.00503/Exporter.pm line 67
Exporter::export('Fcntl', 'main', ':seek') called at
/usr/perl5/5.00503/Exporter.pm line 182
Exporter::import('Fcntl', ':seek') called at lists.pl line 3
main::BEGIN() called at /usr/perl5/5.00503/Carp.pm line 3
eval {...} called at /usr/perl5/5.00503/Carp.pm line 3

I am using the following syntax to import:

use Fcntl qw/:seek/;

And the following to invoke:

seek $list, 0, SEEK_SET or die "Cannot seek on '$file' $!";


I know I should be able to figure this out on my own but I am pretty new
to perl and have been on vacation for a month so to say I am rusty is a
bit of an understatement.  Can someone please tell me what I am doing
wrong?

Thanks,

Dylan



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Module import error

2003-01-09 Thread Rob Dixon
Hi Dylan

Check your version of Fcntl. The EXPORT_TAGS hash in Fcntl.pm should have an
key of 'seek' which, according to the Perl dianostics, it doesn't.

As a quick fix you could try:

use Fcntl qw(SEEK_SET SEEK_CUR SEEK_END);

HTH,

Rob


"Dylan Boudreau" <[EMAIL PROTECTED]> wrote in message
004001c2b7f8$082c5250$0400a8c0@dylan">news:004001c2b7f8$082c5250$0400a8c0@dylan...
> I am trying to use seek from Fcntl and am getting the following errors
> when I try and run the program.
>
> "seek" is not defined in %Fcntl::EXPORT_TAGS at
> /usr/perl5/5.00503/Exporter.pm line 67
> Exporter::export('Fcntl', 'main', ':seek') called at
> /usr/perl5/5.00503/Exporter.pm line 182
> Exporter::import('Fcntl', ':seek') called at lists.pl line 3
> main::BEGIN() called at /usr/perl5/5.00503/Carp.pm line 3
> eval {...} called at /usr/perl5/5.00503/Carp.pm line 3
>
> I am using the following syntax to import:
>
> use Fcntl qw/:seek/;
>
> And the following to invoke:
>
> seek $list, 0, SEEK_SET or die "Cannot seek on '$file' $!";
>
>
> I know I should be able to figure this out on my own but I am pretty new
> to perl and have been on vacation for a month so to say I am rusty is a
> bit of an understatement.  Can someone please tell me what I am doing
> wrong?
>
> Thanks,
>
> Dylan
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Timothy Johnson

I am also on the top-posting side of the issue, but I know that there are
also a substantial number of people who prefer posting their message at the
end.  In the end, I think it is really just a matter of preference, so I
wouldn't worry about it too much.

-Original Message-
From: Michael Weber [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 7:56 AM
To: [EMAIL PROTECTED]
Subject: Re: Top Posting Preferences (was navigate the directories)


Give me top-posting any day!  I can sort by thread and read an entire
discussion without paging down once.

Personal preference, of course.

-Michael

>>> "Rob Dixon" <[EMAIL PROTECTED]> 01/09/03 09:52AM >>>
Hi John, all

"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> [ top-posting fixed ]

I'm wondering how much of an error, if any, people think this is? I
personally choose to top-post so that anybody reading through a thread
won't
have to page to the end of each post to get to new content. Also
end-posting
can be missed by those who don't think to look there! I can find
nothing in
the group guidelines to support either method.

I'd like to do what people prefer so, comments please...?

Thanks,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Top Posting Preferences

2003-01-09 Thread Christopher Kruslicky
On Thursday 09 January 2003 10:56 am, Michael Weber wrote:
> Give me top-posting any day!  I can sort by thread and read an entire
> discussion without paging down once.
>
> Personal preference, of course.
>
> -Michael
>

Bottom-posting makes google more useful in my opinion.  If a solution is 
found in archives, bottom posting is easier to follow in a given 
message.  That's just my take on it.

Christopher

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Jenda Krynicky
From: "Rob Dixon" <[EMAIL PROTECTED]>
> Hi John, all
> 
> "John W. Krahn" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > [ top-posting fixed ]
> 
> I'm wondering how much of an error, if any, people think this is? I
> personally choose to top-post so that anybody reading through a thread
> won't have to page to the end of each post to get to new content. Also
> end-posting can be missed by those who don't think to look there! I
> can find nothing in the group guidelines to support either method.
> 
> I'd like to do what people prefer so, comments please...?

If you top post then I will have to scroll. And ... what's even worse 
... fix your top-posting if I am to respond.


You are replying to something, why would you put the reply first and 
the question next? Keep in mind that this is a mailing list, not a 
private communication. Therefore you should consider each mail to be 
(almost) selfcontained. I do not store the emails, I do not remember 
all the emails I've seen, I read most of them as they come so I can't 
even sort by thread and read the whole thread at once. Therefore I 
need to read the question before I know whether I'm interested in the 
answer and whether I could possibly extend it or correct it if it's 
wrong.

Besides. It's NOT top-post versus bottom-post. If you quote a message 
properly (for my definition of properly) then your replies are 
interspersed with the original message. If there were several 
questions you SHOULD respond to each separately, not wait to the end 
of the message. That way YOU do not have to scroll. You do not have 
to look several times into the original message to make sure you did 
not forget one of the questions, you do not have to describe where in 
the code was the problem ...

And you should ALWAYS delete evertthing that's not important in the 
original. Especialy the signatures.

The way I do it is ... I scan the message quickly. If it sounds 
interesting and I feel like replying I click the Reply button, which 
copies the original email properly quoted into a new window.
In the new window I read the message, delete unimportant lines, add 
comments, read the next chunk, answer the next question, ...

And when I run out of things to respond to I'm done.

And the reader can see ... to this line he responded with this, to 
that line with that, this line of code provoked this remark ...

Jenda
== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
 -- Larry Wall in <[EMAIL PROTECTED]>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: length of hash name

2003-01-09 Thread Jenda Krynicky
From: "Rob Dixon" <[EMAIL PROTECTED]>
> Unless there is a fixed limit, which I don't think there is, I imagine
> identifiers are held inside Perl as a C string, which is
> null-terminated and therefore of any length supportable by the
> hardware. I doubt if it will cause you problems. 

No they are not C stringz.

our ${"one\0two"} = 10;
print ${"one\0two"},"\n";

They are Perl strings so they can contain any character you like.
But of course if you do use certain characters you'll have to quote 
the variablename.

Anyway ... I don't think there is any limit (you could reach).
Maybe the variablename cannot be longer than say 4GB, but ... ;-)

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread David T-G
Rob, et al --

...and then Rob Dixon said...
% 
% Hi John, all

Hi!


% 
% "John W. Krahn" <[EMAIL PROTECTED]> wrote in message
% [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
% >
% > [ top-posting fixed ]
% 
% I'm wondering how much of an error, if any, people think this is? I

Oooh, that's quite a can of worms :-)


% personally choose to top-post so that anybody reading through a thread won't

Bleah.


% have to page to the end of each post to get to new content. Also end-posting

Well, that's even worse, so I suppose you're not *all* bad...


% can be missed by those who don't think to look there! I can find nothing in
% the group guidelines to support either method.

Of course not...  This used to be well-known netiquette but, with the
advent of Outhouse and similar mailers as well as the vast expansion of
the 'net (and the blurring of Usenet, WWW, and Internet), it has become
old history or even myth.


% 
% I'd like to do what people prefer so, comments please...?

Well, I know you aren't going to please everyone :-)  You should probably
do what you decide, after consideration, is best and leave it at that.

Bottom-posting is absolutely the worst.  It implies leaving in everything
that has been said so far, which is also the worst.

Top-posting is also way down there, but a little better.  It still
implies leaving in the history of the world, but at least you don't have
to page down through it all.

Quoting the [relevant!] parts of the message and then responding directly
in the body, as I have here, is the best way to go (of course, since it's
what I do :-)  Useless content is removed; [less and less relevant] history
is trimmed away as it becomes ancient; who said what is easily preserved
through quoting levels, and answers or comments are right next to their
respective questions or statements.

While I'm on the subject, breaking lines at 72 chars or so (to leave some
room for said quoting) instead of letting them wrap, posting in ASCII
instead of HTML or both, and succinct signatures (no 40-line masterpieces
of ASCII art, please) are also Very Good Things.

There's lots more, too.  Ask google for 'netiquette' and you'll get lots
of hits, the first of which should be Virginia Shea's book site.  It's
worth checking out the "Looking Good Online" section at

  http://www.albion.com/netiquette/book/0963702513p58.html

and the "Signature Files" section thereafter.


% 
% Thanks,

Sure thing!


% 
% Rob


HTH & HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg36207/pgp0.pgp
Description: PGP signature


Re: uploading and downloading files to MySQL (--2--)

2003-01-09 Thread Mariusz
What type of field should I use for storing the path; just VARCHAR I guess?
And as far as the filenames - make up some random file name for each
submitted file?

thanks,
Mariusz

ps. If storing files in the DB is not common, what exactly is the BLOB type
for?


- Original Message -
From: "R. Joseph Newton" <[EMAIL PROTECTED]>
To: "Mariusz" <[EMAIL PROTECTED]>
Cc: "perl" <[EMAIL PROTECTED]>
Sent: Thursday, January 09, 2003 2:13 AM
Subject: Re: uploading and downloading files to MySQL


> Hi Marius,
>
> Why do it?  Databases are designed for organization of large table and
information about the relationships between theri attributes.  I would
suggest going light, storing only the filename of an image in the db, and
stroing the images files themselves as files.
>
> Joseph
>
> Mariusz wrote:
>
> > Hi,
> >
> > I found some info on how to upload files into a directory on the server
and I was able to do that but can anyone tell me how to upload a file to my
database (MySQL)? I know to use BLOB for the field type (which BLOB
depending on the size) but how do I construct the INSERT or is there a
different special sql command just for that?
> > I will also need the visitor to be able to download that file and
display in the browser (in case of the pic) and download the other type of
files (like music) straight to his hard drive. Basically how can I let a
visitor download the file from my database?
> >
> > I'll also greatly appreciate any pointers to some articles on the net.
> >
> > thank you,
> > Mariusz
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




upload progress

2003-01-09 Thread Mariusz
I know perl CGI is a server side, but maybe someone can suggest how to show a progress 
window on the client's machine while a file is being uploaded?

thank you,
Mariusz



RE: Module import error

2003-01-09 Thread Dylan Boudreau
I was meaning to upgrade to a 5.8.0 anyway and this was just the push I
needederror is gone now, script still doesn't work right but the
error is gone...

Thanks,

Dylan

-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]] 
Sent: January 9, 2003 12:15 PM
To: [EMAIL PROTECTED]
Subject: Re: Module import error


Hi Dylan

Check your version of Fcntl. The EXPORT_TAGS hash in Fcntl.pm should
have an key of 'seek' which, according to the Perl dianostics, it
doesn't.

As a quick fix you could try:

use Fcntl qw(SEEK_SET SEEK_CUR SEEK_END);

HTH,

Rob


"Dylan Boudreau" <[EMAIL PROTECTED]> wrote in message
004001c2b7f8$082c5250$0400a8c0@dylan">news:004001c2b7f8$082c5250$0400a8c0@dylan...
> I am trying to use seek from Fcntl and am getting the following errors

> when I try and run the program.
>
> "seek" is not defined in %Fcntl::EXPORT_TAGS at 
> /usr/perl5/5.00503/Exporter.pm line 67
> Exporter::export('Fcntl', 'main', ':seek') called at 
> /usr/perl5/5.00503/Exporter.pm line 182
> Exporter::import('Fcntl', ':seek') called at lists.pl line 3
> main::BEGIN() called at /usr/perl5/5.00503/Carp.pm line 3
> eval {...} called at /usr/perl5/5.00503/Carp.pm line 3
>
> I am using the following syntax to import:
>
> use Fcntl qw/:seek/;
>
> And the following to invoke:
>
> seek $list, 0, SEEK_SET or die "Cannot seek on '$file' $!";
>
>
> I know I should be able to figure this out on my own but I am pretty 
> new to perl and have been on vacation for a month so to say I am rusty

> is a bit of an understatement.  Can someone please tell me what I am 
> doing wrong?
>
> Thanks,
>
> Dylan
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reqxp help

2003-01-09 Thread Jensen Kenneth B SrA AFPC/DPDMPQ
Trying to make a one liner regxp to covert a file. File has lines like these
(lines are preceded with a space)

 Dec 20 13:28 guard/AFRC_AFRC00_01 
 Nov 22 2001 guard/ANCHORAGE_668300_14
 Dec 20 08:46 guard/ALPENA_MI_503000_79
 Dec 30 06:51 guard/ANDREWS_MD_525700_93

Output needs to look like this with pipelines inserted. 
 Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01 
 Nov| 22| 2001 |guard/|ANCHORAGE_6683|00_|14
 Dec| 20| 08:46 |guard/|ALPENA_MI_5030|00_|79
 Dec| 30| 06:51 |guard/|ANDREWS_MD_5257|00_|93

The regex's I've tried have been pretty far off. Any help in this greatly
appreciated.

Ken



Extracting Info from a websource

2003-01-09 Thread Sukrit

Hi listers,

i am a perl beginner with an interesting problem (to me atleast :).

Problem Overview
- 
Somewhere on the world wide web, exists an asp page with the following
form -


On entering a valid roll number and pressing enter, results for that number
are displayed. Currently this has to be done manually, for say 120
students. Very painful indeed.

1 What i can manage
- ---
i can,
1.1 Generate valid numbers.
1.2 Extract information from an html page.

2 What i need to know
- -
i need to know how to,
2.1 Enter info in a form at a particular url.
2.2 Save the resultant file on locally. (for 1.2 above)


i have just read Learning Perl, so that is my skill level. Any pointers?

Regards,

sukrit 

-- 
 __
/  [EMAIL PROTECTED]  ||http://www.symonds.net/~holysmoke  \
|  GPG: 77D81FC4  9368 9352 BBF7 6390 0E40 FC88 5903 2CD5 77D8 1FC4|


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Reqxp help

2003-01-09 Thread Mark Anderson

-Original Message-
From: Jensen Kenneth B SrA AFPC/DPDMPQ
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 10:59 AM
To: '[EMAIL PROTECTED]'
Subject: Reqxp help


Trying to make a one liner regxp to covert a file. File has lines like these
(lines are preceded with a space)

 Dec 20 13:28 guard/AFRC_AFRC00_01
 Nov 22 2001 guard/ANCHORAGE_668300_14
 Dec 20 08:46 guard/ALPENA_MI_503000_79
 Dec 30 06:51 guard/ANDREWS_MD_525700_93

Output needs to look like this with pipelines inserted.
 Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01
 Nov| 22| 2001 |guard/|ANCHORAGE_6683|00_|14
 Dec| 20| 08:46 |guard/|ALPENA_MI_5030|00_|79
 Dec| 30| 06:51 |guard/|ANDREWS_MD_5257|00_|93

The regex's I've tried have been pretty far off. Any help in this greatly
appreciated.

Ken

-Response Follows-

I'd like to see what you tried.  I just walked through what I saw you
wanted, literally, almost a character at a time and came up with the
following pretty quickly:

@arr = (' Dec 20 13:28 guard/AFRC_AFRC00_01 ',
' Nov 22 2001 guard/ANCHORAGE_668300_14 ',
' Dec 20 08:46 guard/ALPENA_MI_503000_79 ',
' Dec 30 06:51 guard/ANDREWS_MD_525700_93 ');

foreach $str (@arr) {
if ($str =~ /( \w{3})( \d{2})(
\d{2}:?\d{2} )(\w+\/)(.*)(\d{2}_)(\d{2} )/) {
print $1.'|'.$2.'|'.$3.'|'.$4.'|'.$5.'|'.$6.'|'.$7."\n";
} else {
print "bad regexp\n";
}
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Reqxp help

2003-01-09 Thread Rob Dixon
Ken

What exactly are the rules? I wrote this:

my @file = (
' Dec 20 13:28 guard/AFRC_AFRC00_01',
' Nov 22 2001 guard/ANCHORAGE_668300_14',
' Dec 20 08:46 guard/ALPENA_MI_503000_79',
' Dec 30 06:51 guard/ANDREWS_MD_525700_93' );

@file = map {
s/\b(?=\s)/|/g;
s/(?<=\/)/|/g;
s/(\d\d_)(\d\d)$/|$1|$2/g;
$_} @file;

print "$_\n" foreach @file;

which outputs this:

 Dec| 20| 13:28| guard/|AFRC_AFRC|00_|01
 Nov| 22| 2001| guard/|ANCHORAGE_6683|00_|14
 Dec| 20| 08:46| guard/|ALPENA_MI_5030|00_|79
 Dec| 30| 06:51| guard/|ANDREWS_MD_5257|00_|93

which is what you wanted except that the separator doesn't immediately
precede 'guard'.

Rob

"Jensen Kenneth B Sra Afpc/Dpdmpq" <[EMAIL PROTECTED]> wrote in
message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Trying to make a one liner regxp to covert a file. File has lines like
these
> (lines are preceded with a space)
>
>  Dec 20 13:28 guard/AFRC_AFRC00_01
>  Nov 22 2001 guard/ANCHORAGE_668300_14
>  Dec 20 08:46 guard/ALPENA_MI_503000_79
>  Dec 30 06:51 guard/ANDREWS_MD_525700_93
>
> Output needs to look like this with pipelines inserted.
>  Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01
>  Nov| 22| 2001 |guard/|ANCHORAGE_6683|00_|14
>  Dec| 20| 08:46 |guard/|ALPENA_MI_5030|00_|79
>  Dec| 30| 06:51 |guard/|ANDREWS_MD_5257|00_|93
>
> The regex's I've tried have been pretty far off. Any help in this greatly
> appreciated.
>
> Ken
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Extracting Info from a websource

2003-01-09 Thread Rob Dixon
Well, I'm not sure what to do here. It's quite possible - I would use
modules LWP, HTTP::Request::Form and HTML::TreeBuilder - but if you've only
just read LP then I doubt you would understand how to do it. I could write
the code for you (which I'm happy to if you want) but that wouldn't teach
you anything. If you can 'extract information from an HTML page' does that
mean you can retrieve it with Perl?

Over to you: how can I/we best help?

Cheers,

Rob


"Sukrit" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Hi listers,
>
> i am a perl beginner with an interesting problem (to me atleast :).
>
> Problem Overview
> - 
> Somewhere on the world wide web, exists an asp page with the following
> form -
> 
>
> On entering a valid roll number and pressing enter, results for that
number
> are displayed. Currently this has to be done manually, for say 120
> students. Very painful indeed.
>
> 1 What i can manage
> - ---
> i can,
> 1.1 Generate valid numbers.
> 1.2 Extract information from an html page.
>
> 2 What i need to know
> - -
> i need to know how to,
> 2.1 Enter info in a form at a particular url.
> 2.2 Save the resultant file on locally. (for 1.2 above)
>
>
> i have just read Learning Perl, so that is my skill level. Any pointers?
>
> Regards,
>
> sukrit
>
> --
>  __
> /  [EMAIL PROTECTED]  ||http://www.symonds.net/~holysmoke  \
> |  GPG: 77D81FC4  9368 9352 BBF7 6390 0E40 FC88 5903 2CD5 77D8 1FC4|
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: uploading and downloading files to MySQL (--2--)

2003-01-09 Thread R. Joseph Newton
Hi Mariusz,

I'd say VARCHAR(255), although even that leads to a sticky issue with DBs, since paths 
can be of any length up to the system maximum, [which may or may not exist].

It is true that the BLOB type exists in most databases, as a convenience.  There may 
be some cases where the DB would be any appropriate storage option, such as when 
images contain confidential content and you want the built-in security of DB 
authorization, rather than leaving the files exposed in the general file system.

I guess my general philosophy when choosing applications to handle data, is to look at 
core competencies rather than features.Consider the name BLOB--it pretty much sums up 
the DBs view of the data.  This can be useful for random binary data, ensure that it 
is stored and retransmitted properly, but simply adds an unnecessary extra layer to 
the process when serving up or storing a file in a standard image format.  Most 
systems already have high-quality specialized editors for handling images, and the OS 
handles file system request much more efficiently than a DB.

The core competency of a database is selection by attribute value, generally on 
records of constant width.  The DB specialty skills canbe used to quickly whip out a 
reference to the file-system location of your image, and the much more direct OS file 
services can quickly store it or serve it up.

Joseph

Mariusz wrote:

> What type of field should I use for storing the path; just VARCHAR I guess?
> And as far as the filenames - make up some random file name for each
> submitted file?
>
> thanks,
> Mariusz
>
> ps. If storing files in the DB is not common, what exactly is the BLOB type
> for?
>
> - Original Message -
> From: "R. Joseph Newton" <[EMAIL PROTECTED]>
> To: "Mariusz" <[EMAIL PROTECTED]>
> Cc: "perl" <[EMAIL PROTECTED]>
> Sent: Thursday, January 09, 2003 2:13 AM
> Subject: Re: uploading and downloading files to MySQL
>
> > Hi Marius,
> >
> > Why do it?  Databases are designed for organization of large table and
> information about the relationships between theri attributes.  I would
> suggest going light, storing only the filename of an image in the db, and
> stroing the images files themselves as files.
> >
> > Joseph
> >
> > Mariusz wrote:
> >
> > > Hi,
> > >
> > > I found some info on how to upload files into a directory on the server
> and I was able to do that but can anyone tell me how to upload a file to my
> database (MySQL)? I know to use BLOB for the field type (which BLOB
> depending on the size) but how do I construct the INSERT or is there a
> different special sql command just for that?
> > > I will also need the visitor to be able to download that file and
> display in the browser (in case of the pic) and download the other type of
> files (like music) straight to his hard drive. Basically how can I let a
> visitor download the file from my database?
> > >
> > > I'll also greatly appreciate any pointers to some articles on the net.
> > >
> > > thank you,
> > > Mariusz
> >
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Compariing Apples and Oranges?

2003-01-09 Thread R. Joseph Newton


Bob Williams wrote:

> List 1 is the control list containing: Apple, Orange, Lemon, Tangerine, and Grape.
> List 2 contains Apple, Tangerine, Grape, and Banana.
>
> I need a script ...

Sound like you've got some work cut out for you.  You will probably want to read up on 
the for() and foreach() functions in your text.  Let us know when you run into 
problems, post the code you are trying, and you will find plenty of help. (;:-P )

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: uploading and downloading files to MySQL (--2--)

2003-01-09 Thread Westgate, Jared

Mariusz wrote:

> What type of field should I use for storing the path; just 
> VARCHAR I guess?
> And as far as the filenames - make up some random file name for each
> submitted file?

This is a little off topic for a Perl list, but I'll give it a shot.  Be forewarned, 
that I do not know much about MySQL.  I am writing this based on my experiences with 
Oracle and other DB languages.

It all depends on how you want to handle it.  Varchar would work fine for storing a 
path.  If you wanted to, you could also come up with a random name for the file.  Of 
course, you would have to do some checking to ensure the file name was not in use, or 
maybe just use a fancy directory naming scheme.  

> ps. If storing files in the DB is not common, what exactly is 
> the BLOB type
> for?

Storing files in the DB is not common, but it is used in some cases.  Depending on 
your application, it may be appropriate.  There are several advantages to storing 
these types of files in the database:

1.  You don't have to worry about file names
2.  You get an indexed search to find the file itself.  In other words, you don't need 
another system call to get the file off of the file system and then return it.  
3.  Maybe faster retrieval times (depending on how your hardware and DB are setup).  
Not real likely unless you have a lot of money to work with.  I'm talking Oracle with 
multiple servers, etc.  
4.  Restoring the database will restore the files within it
5.  All of the database features themselves would apply to the files.  For example, 
greater control over security.  

Of course, there are also disadvantages:

1.  Much larger database (this is a big disadvantage)
2.  Probably slower data retrieval times (once again, depending on how things are set 
up).  This would probably be the case for you.
3.  BLOBS, GLOBS, etc are typically much harder to work with

I'm sure there are many other advantages/disadvantages that I could not think of off 
hand.  Just be aware that in most situations, as a general guideline, you want to 
store the path to a file, not the file itself.  I highly suggest trying it both ways 
(although I know that sometimes that is impossible).  But, never take anyone's word 
for it!  :)  Also, try googling for "database storing files" or "database file 
storage" or something like that.  I think you will find a lot of useful information. 

Hope this helps,

Jared

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Reqxp help

2003-01-09 Thread Jensen Kenneth B SrA AFPC/DPDMPQ
Actually, first attempts weren't because of bad regexp but another stupid
bug I had earlier when I was opening the file. I have it working now using:

#!/usr/contrib/bin/perl
open (TEST, "@ARGV[0]");
open (OUT, ">@ARGV[0].out");
while (){
  s/\s(\S+)\s+(\d+)\s+(\S+)\s(\S+\/)(\S+\_)(\S+)(00\_)(\d+)/$1\| $2\| $3
\|$4\|$5\|$6\|$7\|$8/;
  print OUT "$_\n";
}
close OUT;
close TEST;

-Original Message-
From: Mark Anderson [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 09, 2003 1:20 PM
To: Jensen Kenneth B SrA AFPC/DPDMPQ; [EMAIL PROTECTED]
Subject: RE: Reqxp help



-Original Message-
From: Jensen Kenneth B SrA AFPC/DPDMPQ
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 10:59 AM
To: '[EMAIL PROTECTED]'
Subject: Reqxp help


Trying to make a one liner regxp to covert a file. File has lines like these
(lines are preceded with a space)

 Dec 20 13:28 guard/AFRC_AFRC00_01
 Nov 22 2001 guard/ANCHORAGE_668300_14
 Dec 20 08:46 guard/ALPENA_MI_503000_79
 Dec 30 06:51 guard/ANDREWS_MD_525700_93

Output needs to look like this with pipelines inserted.
 Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01
 Nov| 22| 2001 |guard/|ANCHORAGE_6683|00_|14
 Dec| 20| 08:46 |guard/|ALPENA_MI_5030|00_|79
 Dec| 30| 06:51 |guard/|ANDREWS_MD_5257|00_|93

The regex's I've tried have been pretty far off. Any help in this greatly
appreciated.

Ken

-Response Follows-

I'd like to see what you tried.  I just walked through what I saw you
wanted, literally, almost a character at a time and came up with the
following pretty quickly:

@arr = (' Dec 20 13:28 guard/AFRC_AFRC00_01 ',
' Nov 22 2001 guard/ANCHORAGE_668300_14 ',
' Dec 20 08:46 guard/ALPENA_MI_503000_79 ',
' Dec 30 06:51 guard/ANDREWS_MD_525700_93 ');

foreach $str (@arr) {
if ($str =~ /( \w{3})( \d{2})(
\d{2}:?\d{2} )(\w+\/)(.*)(\d{2}_)(\d{2} )/) {
print $1.'|'.$2.'|'.$3.'|'.$4.'|'.$5.'|'.$6.'|'.$7."\n";
} else {
print "bad regexp\n";
}
}



Re: Extracting Info from a websource

2003-01-09 Thread Dave K

> Hi listers,
Hodwy!
> i am a perl beginner with an interesting problem (to me atleast :).
>
> Problem Overview
> - 
> Somewhere on the world wide web, exists an asp page with the following
> form -
> 
These look like 'specs', cool! And I think this format will generate alot of
good 'help'!
> 1 What i can manage
> - ---
> i can,
> 1.1 Generate valid numbers.
> 1.2 Extract information from an html page.
>
> 2 What i need to know
> - -
> i need to know how to,
> 2.1 Enter info in a form at a particular url.
> 2.2 Save the resultant file on locally. (for 1.2 above)
I do not like javascript. There is nothing wrong with it, I just ... well
never mind.
Attached are 2 (javascriptless) scripts, that ask for a number then return
that number's double.
They are meant to represent the script you describe above where the HTTP
request is prepared (sukrit_i.pl) and
its target (sukrit.pl).
Then one can use the LWP::Simple module as follows
perl -MLWP::Simple -e 'getprint
"http://eulerab:62/cgi-bin/sukrit.pl?form1=3"; '
from the command line to see the html output that results.
Both attached scripts are written using the CGI module and  they interact
via the default post method.
I mention this because the LWP example above uses the get method and I am
not sure if other html targets
will be 'smart' enough to handle both/either like CGI is.
Developing a suitable loop to iterate over the required inputs, as well as a
means to direct the output to
a file is left as an exercise ...
HTH and I find your style of posting to be very effective, thanks!


begin 666 sukrit_i.pl
M(R%%.B]097)L+V)I;B]P97)L("UW#0IU"!B96QO=R(L(&)R+ T*:6YP=70H
M('L@+71Y<&4@/3X@)W1E>'0G+ T*"2 @(" @+6YA;64@/3X@)V9O


Help with end-time start-time sorting problem

2003-01-09 Thread Scott, Deborah
I have a txt data file that has several fields. Two of the fields are start
time and end time (listed in epoch time).

I need to write a perl program that finds (and prints) events that occur
between midnight "last night" and "midnight tonight." 

First problem:
The date for midnight "last night" and "tonight" will change each day, so
this needs to be some kind of automatic date finder.

Second problem:
How do I find (and then list) only those events that occur TODAY.
These events might start or stop at any time during the month. 

The events that I would list would include ANYTHING that includes "today."
Some might start today and end today and last only an hour. Some might start
two days ago and end next week. This txt file will also list events that
have already started and stopped last month or will start in the future, so
I have to make sure that these are NOT included in "today's" report.

I know I'll finally hit on the right combination of "if statements" but if
someone already has the answer (or if you like mathematical jigsaw puzzles
like this one)-- I'd appreciate your solution.

Thanks from a new subscriber!

Scotty




Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread R. Joseph Newton
Hi Jenda,

I would suggest that you need a better mail client or message-filing system.  Most 
good mail clients support thread view precisely for discussions such as this.  I can 
look in the navigation pane, expand or collapse threads as needed, and look to the 
source message for reference to the original.  I believe ost others have similar 
facilities, as they come packaged with most mail and news clients.  I did take thirty 
seconds to make a folder for this group, and I do take a minute or two with each 
download to move perl-related messages into that folder.  It's not that mush effort to 
ask.

I do believe that there is a place for inline comments.  When well-placed, they can 
help pinpoint the errors or show how they propgate through a script.  It also does 
impose an extra burden on the reader to parse through messages which they have already 
read.

I would suggest top-posting as a default, inline comments when they serve a real 
purpose, and that each participant in such a discussion must be responsible for his or 
her own retention of the thread--especially while still actively engaged.

Joseph

Jenda Krynicky wrote:

>
> You are replying to something, why would you put the reply first and
> the question next? Keep in mind that this is a mailing list, not a
> private communication. Therefore you should consider each mail to be
> (almost) selfcontained. I do not store the emails, I do not remember
> all the emails I've seen, I read most of them as they come so I can't
> even sort by thread and read the whole thread at once. Therefore I
> need to read the question before I know whether I'm interested in the
> answer and whether I could possibly extend it or correct it if it's
> wrong.
>
> Besides. It's NOT top-post versus bottom-post. If you quote a message
> properly (for my definition of properly) then your replies are
> interspersed with the original message. If there were several
> questions you SHOULD respond to each separately, not wait to the end
> of the message. That way YOU do not have to scroll. You do not have
> to look several times into the original message to make sure you did
> not forget one of the questions, you do not have to describe where in
> the code was the problem ...
>
> And you should ALWAYS delete evertthing that's not important in the
> original. Especialy the signatures.
>
> The way I do it is ... I scan the message quickly. If it sounds
> interesting and I feel like replying I click the Reply button, which
> copies the original email properly quoted into a new window.
> In the new window I read the message, delete unimportant lines, add
> comments, read the next chunk, answer the next question, ...
>
> And when I run out of things to respond to I'm done.
>
> And the reader can see ... to this line he responded with this, to
> that line with that, this line of code provoked this remark ...
>
> Jenda
> == [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
> : What do people think?
> What, do people think?  :-)
>  -- Larry Wall in <[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Help with end-time start-time sorting problem

2003-01-09 Thread Wagner, David --- Senior Programmer Analyst --- WGO
What does your data look like? Always helpful in this area.  Once we
ave an understanding then the others would be relatively simple to
accomplish.

Wags ;)

-Original Message-
From: Scott, Deborah [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 12:26
To: [EMAIL PROTECTED]
Subject: Help with end-time start-time sorting problem


I have a txt data file that has several fields. Two of the fields are start
time and end time (listed in epoch time).

I need to write a perl program that finds (and prints) events that occur
between midnight "last night" and "midnight tonight." 

First problem:
The date for midnight "last night" and "tonight" will change each day, so
this needs to be some kind of automatic date finder.

Second problem:
How do I find (and then list) only those events that occur TODAY.
These events might start or stop at any time during the month. 

The events that I would list would include ANYTHING that includes "today."
Some might start today and end today and last only an hour. Some might start
two days ago and end next week. This txt file will also list events that
have already started and stopped last month or will start in the future, so
I have to make sure that these are NOT included in "today's" report.

I know I'll finally hit on the right combination of "if statements" but if
someone already has the answer (or if you like mathematical jigsaw puzzles
like this one)-- I'd appreciate your solution.

Thanks from a new subscriber!

Scotty



**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Bob Showalter
Rob Dixon wrote:
> I personally choose to top-post so that anybody reading through a
> thread won't have to page to the end of each post to get to new
> content. 

Since all the top-posters are weighing in, I better add my vote against it.
Responses should be in-line and quoted material appropriately trimmed, as
God intended :~)

MS-Outlook users should check out 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Help with end-time start-time sorting problem

2003-01-09 Thread Scott, Deborah
Here's the txt file. Thanks!



-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 2:32 PM
To: Scott, Deborah; [EMAIL PROTECTED]
Subject: RE: Help with end-time start-time sorting problem


What does your data look like? Always helpful in this area.  Once we
ave an understanding then the others would be relatively simple to
accomplish.

Wags ;)

-Original Message-
From: Scott, Deborah [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 12:26
To: [EMAIL PROTECTED]
Subject: Help with end-time start-time sorting problem


I have a txt data file that has several fields. Two of the fields are start
time and end time (listed in epoch time).

I need to write a perl program that finds (and prints) events that occur
between midnight "last night" and "midnight tonight." 

First problem:
The date for midnight "last night" and "tonight" will change each day, so
this needs to be some kind of automatic date finder.

Second problem:
How do I find (and then list) only those events that occur TODAY.
These events might start or stop at any time during the month. 

The events that I would list would include ANYTHING that includes "today."
Some might start today and end today and last only an hour. Some might start
two days ago and end next week. This txt file will also list events that
have already started and stopped last month or will start in the future, so
I have to make sure that these are NOT included in "today's" report.

I know I'll finally hit on the right combination of "if statements" but if
someone already has the answer (or if you like mathematical jigsaw puzzles
like this one)-- I'd appreciate your solution.

Thanks from a new subscriber!

Scotty



**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



ÐÏࡱá>þÿ  
þÿÿÿýÿÿÿþÿÿÿþÿÿÿþÿÿÿþÿÿÿ
   

Root
 Entry
ÀF@»& 
¸Â€WordDocumentCompObjnþÿÿÿÞßý]’»ä

6_ˆ±Ú0[†±Ü2]ˆ³ßýûù÷õóñïíëéçåãáßÝÛÙ×Õ

Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Jenda Krynicky
From: "R. Joseph Newton" <[EMAIL PROTECTED]>
> I would suggest that you need a better mail client or message-filing
> system.  Most good mail clients support thread view precisely for
> discussions such as this. 

I did NOT say my mailer can't sort the messages per thread. Of course 
it can. And of course it can and does filter messages into folders. 
But usualy I do not keep the messages long enough to constitute a 
thread. Therefore I WILL see as a thread the messages that came 
overnight, but if you send a reply while I'm online it's very likely 
that before your reply gets to me the original email is already 
deleted.

> I would suggest top-posting as a default, inline comments when they
> serve a real purpose, and that each participant in such a discussion
> must be responsible for his or her own retention of the
> thread--especially while still actively engaged.

Sorry I get too many emails to bother keeping those I might need just 
to refresh what exactly did what person say. If I'm really interested 
in the thread I might keep it, but don't count on it.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why can't use SQL "GROUP BY..."?

2003-01-09 Thread Jonathan Daugherty
# >  $value2 = $dbh->prepare("SELECT page FROM $Table
# > 
# > GROUP BY page") || die "Couldn't add record, ".$dbh->errstr();
# > 
# > "SQL ERROR: Can't find table names in FROM clause!"

# You should use  $value2 = $dbh->prepare('SELECT page FROM '."$Table".'
# GROUP BY page' etc. or use quote function of dbi module

The quotes are unnecessary.  It seems to me that the problem lies in the
possibility that $Table is probably undefined or an empty string.  Check
that first.  If you still have a problem, make sure you're using the latest
release of DBI/MySQL.  The following is valid perl ONLY if $Table is defined
AND non-empty:

$value2 = $dbh->prepare("SELECT page FROM $Table GROUP BY page");

Use strict to avoid this sort of error.  If you're using strict, then perform
a check on $Table before the query.

-- 

 Jonathan Daugherty
 http://www.cprogrammer.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Reqxp help

2003-01-09 Thread R. Joseph Newton
Hi,

This took a few tries to knock out:
my $In = " Dec 20 13:28 guard/AFRC_AFRC00_01";
#s/ *(\w*) (.*)/ $1| $2|/;
$In =~
s/ *(\w+) +(\d+) +(\d+:\d+) +(.*)\/(\D*_\D*)(\d+)_(\d+)/ $1| $2| $3 |$4\/|$5|$6_|$7/;
print "$In\n";


Desired:
 Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01
Results:
 Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01

Joseph

Jensen Kenneth B SrA AFPC/DPDMPQ wrote:

> Trying to make a one liner regxp to covert a file. File has lines like these
> (lines are preceded with a space)
>
>  Dec 20 13:28 guard/AFRC_AFRC00_01
>  Nov 22 2001 guard/ANCHORAGE_668300_14
>  Dec 20 08:46 guard/ALPENA_MI_503000_79
>  Dec 30 06:51 guard/ANDREWS_MD_525700_93
>
> Output needs to look like this with pipelines inserted.
>  Dec| 20| 13:28 |guard/|AFRC_AFRC|00_|01
>  Nov| 22| 2001 |guard/|ANCHORAGE_6683|00_|14
>  Dec| 20| 08:46 |guard/|ALPENA_MI_5030|00_|79
>  Dec| 30| 06:51 |guard/|ANDREWS_MD_5257|00_|93
>
> The regex's I've tried have been pretty far off. Any help in this greatly
> appreciated.
>
> Ken


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Help with end-time start-time sorting problem

2003-01-09 Thread R. Joseph Newton
So what have you treied so far?  Although production efficiency may be aided by using 
prefab cope, the learning process is not.  you should probably focus attention to the 
sections on the time function.  You may also want to isolate elements of the localtime 
return string to check for the current day.  If you set your variables for the current 
day at the beginning of processing, you can then compare any dates in the file to see 
whether they correspond with the current day.

Joseph

"Scott, Deborah" wrote:

> I have a txt data file that has several fields. Two of the fields are start
> time and end time (listed in epoch time).
>
> I need to write a perl program that finds (and prints) events that occur
> between midnight "last night" and "midnight tonight."
>
> First problem:
> The date for midnight "last night" and "tonight" will change each day, so
> this needs to be some kind of automatic date finder.
>
> Second problem:
> How do I find (and then list) only those events that occur TODAY.
> These events might start or stop at any time during the month.
>
> The events that I would list would include ANYTHING that includes "today."
> Some might start today and end today and last only an hour. Some might start
> two days ago and end next week. This txt file will also list events that
> have already started and stopped last month or will start in the future, so
> I have to make sure that these are NOT included in "today's" report.
>
> I know I'll finally hit on the right combination of "if statements" but if
> someone already has the answer (or if you like mathematical jigsaw puzzles
> like this one)-- I'd appreciate your solution.
>
> Thanks from a new subscriber!
>
> Scotty


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Perry, Alan
Bob Showalter wrote:
> Rob Dixon wrote:
>> I personally choose to top-post so that anybody reading through a
>> thread won't have to page to the end of each post to get to new
>> content.
> 
> Since all the top-posters are weighing in, I better add my vote
> against it. Responses should be in-line and quoted material
> appropriately trimmed, as God intended :~)
> 
> MS-Outlook users should check out
> 

Now, that is about the best "add-in" ever created for Outlook...  Very nice!

And, top-posters can configure it so that they can still top-post, but the
>'s will still get fixed!

He has an Outlook Express version as well at:
http://home.in.tum.de/~jain/software/oe-quotefix/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Perry, Alan
Perry, Alan wrote:
> And, top-posters can configure it so that they can still top-post,
> but the 
>> 's will still get fixed!

Well, I guess it's not perfect...  :-)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Kegs
On Thu, 2003-01-09 at 20:28, R. Joseph Newton wrote:
> Hi Jenda,
> 
> I would suggest that you need a better mail client or message-filing system.
> Most good mail clients support thread view precisely for discussions such as
> this.  

I would suggest that start commenting on other peoples choice of mail
software when you start using a program that doesn't appear to be rather
broken itself, I have just spent a couple of minutes just fixing the
line breaks in your mail, every paragraph appeared on a different line.

Many people use text based mail clients, such as pine(to pick a random
example), because they fit the way that the person reads their mail, if
you are using a mail client that doesn't set its line breaks properly
or, even worse, sends HTML mail by default you will annoy a lot of
people who could help you.

I can look in the navigation pane, expand or collapse threads as needed,
> and look to the source message for reference to the original.  I believe ost 
> others have similar facilities, as they come packaged with most mail and news > 
>clients.  I did take thirty seconds to make a folder for this group, and I do 
> take a minute or two with each download to move perl-related messages into 
> that folder.  It's not that mush effort to ask.

And it isn't much effort to ask someone to write their comments so that
they appear next to whatever they are responding to, the thing is that
involves effort on the writer's part, rather than effort on the
recipient's part. And would it be too much to ask, even if you do insist
on top-posting, for you to actually delete the mail you are replying to,
as it serves no purpose anyway with this particular style of posting,
and some people do actually have to pay for their bandwidth by the
minute[1].

Also this mailing-list in particular does generate a lot of traffic,
and if you are not interspersing your comments between the text then it
is not always obvious which post of many that you are replying to.
People who deal with a lot of mail anyway are rather less likely to go
back through their archive to check what the message you were replying
to was actually about, and in a public forum, such as usenet or mailing
lists it is really the responsibility of the author to make the article
easily understandable, rather than expecting the readers to go out of
their way to make sense of the article. 

> I do believe that there is a place for inline comments.  When well-placed, 
> they can help pinpoint the errors or show how they propgate through a script.  It 
>also does impose an extra burden on the reader to parse through messages which they 
>have already read.

When well placed they make it easy for the reader to see exactly what
point is being addressed at that point in the article, which can in some
cases be less than clear, though not in this particular discussion.
 
> I would suggest top-posting as a default, inline comments when they serve 
> a real purpose,

There is a reason why inline posting is perceived as the default for
posting to public fora on the internet, it is easier to read, tends to
be less ambiguous, and means that comprehension is not limited to those
who have access to all of the articles that the author is addressing.

also the bottom line is that top-posting is just rude (IMO)[2] and
doesn't particularly make sense, as shown by the old joke about it.

A: Because it doesn't make sense.
Q: Why is top-posting bad?

 and that each participant in such a discussion must be 
> responsible for his or her own retention of the thread--especially while 
> still actively engaged.

But the archive may be on another machine, I mainly use this box, but on
occasion I use a laptop, which understandably hasn't got a complete
archive of mails from this list. I imagine that participants in this
list who don't have the luxury of working from home also split their
reading of this list between their home and work computers, where it is
allowed[3]

[snipped Jenda's post]

[1] this is the original reason why top-posting is frowned upon, I
think.

[2] Particularly when combined with leaving the original text, in its
entirety, at the bottom of the message, especially when posting
to usenet

[3] I don't imagine that all that many bosses would be too thrilled to
their employees using company time to post to a mailing list that
isn't directly related to their job.

Oh and I hope that the tone of this isn't too shouty, as it isn't really
meant that way, but top-posting, especially to usenet, does really annoy
me on occasion.

-- 
James
[EMAIL PROTECTED]   invert to reply

Linux- 'Cos Micro$oft is for Capitalists running DOS


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Removing a specific value from a hash whose keys contains multiple values

2003-01-09 Thread Sophia Corwell
I am not sure how to delete a specific value from a
hash whose keys contains multiple values.
 
Could anyone advice, please?
 
Thanks,

Sophia

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Help with end-time start-time sorting problem

2003-01-09 Thread Scott, Deborah
Yes, I think so. THANKS! This is a great fantastic group. Glad I found it. 

>Have got what you need yet?
>Wags ;)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl Subroutines

2003-01-09 Thread Scott, Joshua
I've created a group of Perl subroutines to handle the creation and layout
of my web pages.  These subs are used when browsing to my website.
Basically all they do when invoked is print a bunch of HTML.  I've now run
into the scenario where I'd like to use these same subs to print static web
pages where the output doesn't go to the web browser, but instead goes to a
file.  How could I go about doing that?

Here's an example of what my subs look like:

Sub opentbl {
Print "";
Print "";
Print "";
Print "";
Print "";
};

I call the sub from webpages the standard way.

I sure hope I explained this clearly.  I'm still getting used to Perl.
Thank you for any help you can provide!

Joshua Scott

==
NOTICE - This communication may contain confidential and privileged information that 
is for the sole use of the intended recipient. Any viewing, copying or distribution 
of, or reliance on this message by unintended recipients is strictly prohibited. If 
you have received this message in error, please notify us immediately by replying to 
the message and deleting it from your computer.

==


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Removing a specific value from a hash whose keys contains multiple values

2003-01-09 Thread Sophia Corwell
Sorry about that...

Here is an example:

Here is what my hash looks like:

%compilers = (
   system1 => ['compiler_a'],
   system2 => ['compiler_b',
'compiler_c','compiler_d'],
   system3 => ['compiler_e'],
);

Now, if I want to delete just the 'compiler_c' value
from the system2 key, can I use the delete function or
the pop function?


--- Mark Anderson <[EMAIL PROTECTED]> wrote:
> Could you give us an example?
> 
>   Thanks,
>   /\/\ark
> 
> -Original Message-
> From: Sophia Corwell
> [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 09, 2003 3:58 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Removing a specific value from a hash whose
> keys contains
> multiple values
> 
> 
> I am not sure how to delete a specific value from a
> hash whose keys contains multiple values.
>  
> Could anyone advice, please?
>  
> Thanks,
> 
> Sophia
> 
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Set cookie and then redirect

2003-01-09 Thread Fred Sahakian
Id like to set a cookie in Perl and then redirect to another URL.
Ive tried the below code, it will set the cookie but then the browser
hangs, is it because it is 2 requests going to the header at the same
time, or possibly not enought time for the cookie to be set?

print "Set-cookie: value=bob;";
print "Location: http://www.something.com/\n\n";;

Any ideas?



Re: Removing a specific value from a hash whose keys contains multiple values

2003-01-09 Thread Wiggins d'Anconia
I am not sure I understand you correctly.  Are you referring to a hash 
which may have a list of values stored with a particular key?  Keys by 
the nature of a hash must be unique, so the hash is changed/deleted from 
in the same way regardless.

I also didn't understand if you meant clearing the value, or removing 
the whole key and value pair.

$hash{'key'} = undef;
will clear the value regardless of what it contained, but will leave the 
key in place.

delete $hash{'key'};
will remove the key and consequently the value that it contained.

If this doesn't resolve the problem please be more specific or give an 
example.

http://danconia.org

Sophia Corwell wrote:
I am not sure how to delete a specific value from a
hash whose keys contains multiple values.
 
Could anyone advice, please?
 
Thanks,

Sophia

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Removing a specific value from a hash whose keys contains multiple values

2003-01-09 Thread david
Sophia Corwell wrote:

> Sorry about that...
> 
> Here is an example:
> 
> Here is what my hash looks like:
> 
> %compilers = (
>system1 => ['compiler_a'],
>system2 => ['compiler_b',
> 'compiler_c','compiler_d'],
>system3 => ['compiler_e'],
> );
> 
> Now, if I want to delete just the 'compiler_c' value
> from the system2 key, can I use the delete function or
> the pop function?

have you try:

#!/usr/bin/perl -w
use strict;

my %compilers = (
   system1 => ['compiler_a'],
   system2 => ['compiler_b','compiler_c','compiler_d'],
   system3 => ['compiler_e'],
);

splice(@{$compilers{system2}},1,1);

while(my($key,$ref) = each %compilers){
print "$key: @{$ref}\n";
}

__END__

prints:

system2: compiler_b compiler_d
system1: compiler_a
system3: compiler_e

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Removing a specific value from a hash whose keys contains multiple values

2003-01-09 Thread Wiggins d'Anconia
Thanks for the example :-).  You want either 'delete' or 'splice' 
Depending on whether you want the indexes to be shifted down, see 
perldoc -f delete and perldoc -f splice.

"Deleting an array element effectively returns that position of the 
array to its initial, uninitialized state.  Subsequently testing for the 
same element with exists() will return false. Note that deleting array 
elements in the middle of an array will not shift the index of the ones 
after them down--use splice() for that.  See "exists"."

http://danconia.org


Sophia Corwell wrote:
Sorry about that...

Here is an example:

Here is what my hash looks like:

%compilers = (
   system1 => ['compiler_a'],
   system2 => ['compiler_b',
'compiler_c','compiler_d'],
   system3 => ['compiler_e'],
);

Now, if I want to delete just the 'compiler_c' value
from the system2 key, can I use the delete function or
the pop function?


--- Mark Anderson <[EMAIL PROTECTED]> wrote:


Could you give us an example?

		Thanks,
			/\/\ark

-Original Message-
From: Sophia Corwell
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 3:58 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Removing a specific value from a hash whose
keys contains
multiple values


I am not sure how to delete a specific value from a
hash whose keys contains multiple values.

Could anyone advice, please?

Thanks,

Sophia

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up
now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]





__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




suppress STDIN from user

2003-01-09 Thread Jose Malacara
Is there a way for perl to suppress or mask user input at the STDIN? For example, a 
password or login prompt Not really trying to implement any real security here, 
just curious.

This is what I I would like:

Enter your login:# suppressed from output
Welcome, admin.

or

Enter your login: *# masked by asterisks
Welcome, admin.



#!/usr/bin/perl

&prompt;

sub prompt {
  print "Enter your login: ";
  $login = ;
  chomp ($login);
  &check($login);
}

sub check {
  if ($login ne "admin") {
&prompt;
}else{
print "Welcome, $login\n";
}
}


Thanks!


Re: Set cookie and then redirect

2003-01-09 Thread Wiggins d'Anconia


Fred Sahakian wrote:

Id like to set a cookie in Perl and then redirect to another URL.
Ive tried the below code, it will set the cookie but then the browser
hangs, is it because it is 2 requests going to the header at the same
time, or possibly not enought time for the cookie to be set?

print "Set-cookie: value=bob;";
print "Location: http://www.something.com/\n\n";;

Any ideas?



Maybe what you thought first. Might also need a new line after the 
cookie line, as it may be running the Location into part of the cookie 
parameters.

http://danconia.org


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Wiggins d'Anconia
How about top posting where it makes sense, aka the argument has shifted 
substantially, the original poster had no clue what they were talking 
about :-), etc.  But many times inline comments in code is much shorter 
for the answerer and easier for both to understand, seems like it really 
depends on context. I must say I like not having to page down at work 
where I have small monitor and read through a browser, but then again I 
have such a small font on such a big monitor at homeCan't please 
everyone, or even the same person all the time ;-).

http://danconia.org

Rob Dixon wrote:
Hi John, all

"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


[ top-posting fixed ]



I'm wondering how much of an error, if any, people think this is? I
personally choose to top-post so that anybody reading through a thread won't
have to page to the end of each post to get to new content. Also end-posting
can be missed by those who don't think to look there! I can find nothing in
the group guidelines to support either method.

I'd like to do what people prefer so, comments please...?

Thanks,

Rob







--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Wiggins d'Anconia
Sorry about the late post. Now I wish they would fix mozilla so it would 
recognize threads that have completely different subject lines as new 
threads instead of using whatever mail header, I thought the posts for 
the thread were concluded after two as I saw a bunch of replies that 
ended up under the first of a new topic thread... grrr. nothing to 
see here :-).

http://danconia.org


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Perl Subroutines

2003-01-09 Thread Scott, Joshua
Let me add a little more info regarding my question.  The subroutines are
already setup and can't be modified easily.  The basic task of all the
different subs is to print to STDOUT.  I'd really like to be able to call
this sub from another script and somehow redirect the output to a file
without modifying the subs code.  

Joshua Scott
Security Systems Analyst, CISSP
626-568-7024


-Original Message-
From: Scott, Joshua 
Sent: Thursday, January 09, 2003 4:07 PM
To: [EMAIL PROTECTED]
Subject: Perl Subroutines


I've created a group of Perl subroutines to handle the creation and layout
of my web pages.  These subs are used when browsing to my website. Basically
all they do when invoked is print a bunch of HTML.  I've now run into the
scenario where I'd like to use these same subs to print static web pages
where the output doesn't go to the web browser, but instead goes to a file.
How could I go about doing that?

Here's an example of what my subs look like:

Sub opentbl {
Print "";
Print "";
Print "";
Print "";
Print "";
};

I call the sub from webpages the standard way.

I sure hope I explained this clearly.  I'm still getting used to Perl. Thank
you for any help you can provide!

Joshua Scott


==
NOTICE - This communication may contain confidential and privileged
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.


==


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



==
NOTICE - This communication may contain confidential and privileged
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.


==


==
NOTICE - This communication may contain confidential and privileged information that 
is for the sole use of the intended recipient. Any viewing, copying or distribution 
of, or reliance on this message by unintended recipients is strictly prohibited. If 
you have received this message in error, please notify us immediately by replying to 
the message and deleting it from your computer.

==


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl Subroutines

2003-01-09 Thread Rob Dixon
Hi Joshua

Just redirect STDOUT to the file using open:

open STDOUT, "> file.htm" or die $!;
opentbl();
close STDOUT;

HTH,

Rob

"Joshua Scott" <[EMAIL PROTECTED]> wrote in message
5D23931127B7EB409640001B7E8A6E32014A2AFA@PASNT32">news:5D23931127B7EB409640001B7E8A6E32014A2AFA@PASNT32...
> I've created a group of Perl subroutines to handle the creation and layout
> of my web pages.  These subs are used when browsing to my website.
> Basically all they do when invoked is print a bunch of HTML.  I've now run
> into the scenario where I'd like to use these same subs to print static
web
> pages where the output doesn't go to the web browser, but instead goes to
a
> file.  How could I go about doing that?
>
> Here's an example of what my subs look like:
>
> Sub opentbl {
> Print "";
> Print "";
> Print "";
> Print "";
> Print "";
> };
>
> I call the sub from webpages the standard way.
>
> I sure hope I explained this clearly.  I'm still getting used to Perl.
> Thank you for any help you can provide!
>
> Joshua Scott
>
>

==
> NOTICE - This communication may contain confidential and privileged
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.
>
>

==
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread R. Joseph Newton
Hi James,

You had one good point there.  I have now turned "automaticallly quote reply" off in 
my m,ailer preferences.  Now my replies shoulkld include only such part of the 
originals as is necessary to make the connection to the prior post.  I will answer 
another point, also:

"...every paragraph appeared on a different line."

Of course--which is the only place for a line break in the current century.  I am not 
taking responsibility for someone elses choice to read their mail in a dripping cave 
by the light of a tallow candle.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Removing a specific value from a hash whose keys contains mul tiple values

2003-01-09 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Sophia Corwell wrote:
> multiple values
> 
> 
> Sorry about that...
> 
> Here is an example:
> 
> Here is what my hash looks like:
> 
> %compilers = (
>system1 => ['compiler_a'],
>system2 => ['compiler_b',
> 'compiler_c','compiler_d'],
>system3 => ['compiler_e'],
> );
> 
> Now, if I want to delete just the 'compiler_c' value
> from the system2 key, can I use the delete function or
> the pop function?
> 
> 
> --- Mark Anderson <[EMAIL PROTECTED]> wrote:
>> Could you give us an example?
>> 
>>  Thanks,
>>  /\/\ark
>> 
>> -Original Message-
>> From: Sophia Corwell
>> [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, January 09, 2003 3:58 PM
>> To: [EMAIL PROTECTED]
>> Cc: [EMAIL PROTECTED]
>> Subject: Removing a specific value from a hash whose keys contains
>> multiple values
>> 
>> 
>> I am not sure how to delete a specific value from a
>> hash whose keys contains multiple values.
>> 
>> Could anyone advice, please?
>> 
>> Thanks,
>> 
>> Sophia
Given your setup, here is a start:

my %compilers = (
   system1 => ['compiler_a'],
   system2 => ['compiler_b',
'compiler_c','compiler_d'],
   system3 => ['compiler_e'],
  );
my $MyCheck = 'compiler_c'; # what I want to remove
my @MyDelete = ();  # hold indexes which I want to delete
my $MyDelPrt = '';  # whether item deleted or not

printf"Original List:\n";
foreach my $MyKey ( keys %compilers ) {
printf "%-s(", $MyKey;  # Print main Key
my $MyMax = scalar(@{$compilers{$MyKey}});  # Get the number of items in
the array
printf "%2d):\n", $MyMax;
for(my $MyId=0;$MyId<$MyMax;$MyId++) {
$MyDelPrt = '';
if ( $compilers{$MyKey}[$MyId] =~ /\Q$MyCheck\E/i ) {  # if matches
what looking for
push( @MyDelete, $MyId);   # push on
to delete array
$MyDelPrt = '(d)'; # part to
display
 }
printf "  %-s%-4s",$compilers{$MyKey}[$MyId], $MyDelPrt;
 }
printf "\n";
foreach ( @MyDelete ) {
splice(@{$compilers{$MyKey}},$_,1);   # remove
the items found if any
 }
 }

printf"Modified List:\n"; #
Reprint the modified array
foreach my $MyKey ( keys %compilers ) {
printf "%-s(", $MyKey;
my $MyMax = scalar(@{$compilers{$MyKey}});
printf "%2d):\n", $MyMax;
for(my $MyId=0;$MyId<$MyMax;$MyId++) {
printf "  %-s",$compilers{$MyKey}[$MyId];
 }
printf "\n";
 }

Output:

Original List:
system1( 1):
  compiler_a
system2( 3):
  compiler_b  compiler_c(d)   compiler_d
system3( 1):
  compiler_e

Modified List:
system1( 1):
  compiler_a
system2( 2):
  compiler_b  compiler_d
system3( 1):
  compiler_e


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: suppress STDIN from user

2003-01-09 Thread simran
Have a look at Term::ReadKey ...

You need to set noecho (i think...)


On Fri, 2003-01-10 at 11:32, Jose Malacara wrote:
> Is there a way for perl to suppress or mask user input at the STDIN? For example, a 
>password or login prompt Not really trying to implement any real security here, 
>just curious.
> 
> This is what I I would like:
> 
> Enter your login:# suppressed from output
> Welcome, admin.
> 
> or
> 
> Enter your login: *# masked by asterisks
> Welcome, admin.
> 
> 
> 
> #!/usr/bin/perl
> 
> &prompt;
> 
> sub prompt {
>   print "Enter your login: ";
>   $login = ;
>   chomp ($login);
>   &check($login);
> }
> 
> sub check {
>   if ($login ne "admin") {
> &prompt;
> }else{
> print "Welcome, $login\n";
> }
> }
> 
> 
> Thanks!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Perl Subroutines

2003-01-09 Thread Scott, Joshua
Wow, that was really easy!  Thank you very much for your help!!  

Joshua Scott
Security Systems Analyst, CISSP
626-568-7024


-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 09, 2003 5:11 PM
To: [EMAIL PROTECTED]
Subject: Re: Perl Subroutines


Hi Joshua

Just redirect STDOUT to the file using open:

open STDOUT, "> file.htm" or die $!;
opentbl();
close STDOUT;

HTH,

Rob

"Joshua Scott" <[EMAIL PROTECTED]> wrote in message
5D23931127B7EB409640001B7E8A6E32014A2AFA@PASNT32">news:5D23931127B7EB409640001B7E8A6E32014A2AFA@PASNT32...
> I've created a group of Perl subroutines to handle the creation and 
> layout of my web pages.  These subs are used when browsing to my 
> website. Basically all they do when invoked is print a bunch of HTML.  
> I've now run into the scenario where I'd like to use these same subs 
> to print static
web
> pages where the output doesn't go to the web browser, but instead goes 
> to
a
> file.  How could I go about doing that?
>
> Here's an example of what my subs look like:
>
> Sub opentbl {
> Print "";
> Print "";
> Print "";
> Print "";
> Print "";
> };
>
> I call the sub from webpages the standard way.
>
> I sure hope I explained this clearly.  I'm still getting used to Perl. 
> Thank you for any help you can provide!
>
> Joshua Scott
>
>

==
> NOTICE - This communication may contain confidential and privileged
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.
>
>

==
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


==
NOTICE - This communication may contain confidential and privileged information that 
is for the sole use of the intended recipient. Any viewing, copying or distribution 
of, or reliance on this message by unintended recipients is strictly prohibited. If 
you have received this message in error, please notify us immediately by replying to 
the message and deleting it from your computer.

==


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




more on Files

2003-01-09 Thread Mark Goland
So once you know that its a filehandle, how [ if you can ] can you tell
which file its associated with ??

Mark


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl Subroutines

2003-01-09 Thread R. Joseph Newton
Hi Joshua,

It looks like you will need to add some paramaters and support functions to get 
practical use from this sub:

Sub opentbl {
   my ($rows, $cols) = @_
   my $currentRow, $currentCol;
   Print "";
   for (currentRow = 1; $currentRow <= $rows; $currentRow++) {
  for ($currentCol = 0; currentCol <= $cols; $currentCol++) {
 print " ";
 FillData($currentRow, $currentCol);
 print "  \n";
  }
   }
   Print "";
};

Here $rows and $cols are parameters you pass in to the function, and FillData would be 
the function you call to fill in the cells themselves.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: bandwidth restricting

2003-01-09 Thread Victor Tsang
If you have a linux box, It might be a better idea to employ the traffic
shapper that comes with the linux kernel instead.

Tor.

mod_perl wrote:
> 
> hi all,
>In my Lan I have a linux proxy .How  can i restrict the bandwidth
> cosumed by each user using perl .Which module i can use .
>thanks in advance
> 
> shine
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: hash & arrays

2003-01-09 Thread Victor Tsang
you second @EXPORT_OK= statement reset the EXPORT_OK array, I believe
the correct syntex should be.

our @EXPORT_OK = qw(@T_AREA %T_IDS);

Tor.

Jerry Preston wrote:
> 
> Hi!,
> 
> I do not understand what I am doing wrong.  I can pass an hash this way and
> not an array using the following:
> 
>require Exporter;
> 
>our @ISA = qw(Exporter);
>our @EXPORT = qw();
>our @EXPORT_OK = qw( @T_AREA );
>our @EXPORT_OK = qw( %T_IDS );
> 
> where
> 
>   @T_AREA = ( "", "NORTH", "SOUTH" );
> 
>   %T_IDS = (
>  NORTH=> [ qw/KT201 KT202 KT203 KT210 KT211 KT212 KT215
> KT216 KT217 KT218 KT219 KT220 KT221/ ],
> 
>  SOUTH=> [ qw/PT211 PT212 PT213 PT214 PT215 PT216 PT217
> PT218/ ],
> 
>   );
> 
> Why can I not export the array T_AREA ?
> 
> Thanks,
> 
> Jerry

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




perl monger needed asap...

2003-01-09 Thread Benjamin Jurado
how can i store the results in a array,hash,reference...

use File::Find;
use strict;
my $foo1="/path/to/something";
sub foo{
#some filtering operations or even passing to another object or subroutine
}
find(\foo,$foo1);

I have tried passing \@foo and access this via $foo1->() but it did not
work. thanks


-- 
Benjamin F. Jurado
IT&E 
GMU


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: more on Files

2003-01-09 Thread Wiggins d'Anconia
Mark Goland wrote:

So once you know that its a filehandle, how [ if you can ] can you tell
which file its associated with ??

Mark



Interesting question, but it seems from my recent dealings with such 
things, that you can't, because a filehandle doesn't necessarily have to 
be attached to a 'file' at all. It could be attached to a pipe as well, 
which still has a file descriptor (two essentially) but no file on the 
file system, per se.  And the only way to attach a filehandle to a file 
is to perform an open, and theoretically the only way to perform an open 
is to either associate it with another pre-existing file descriptor 
(read: file you opened, pipe, etc.) or a path to the file, and if you 
are the one doing the opening then seemingly you would know what 
filehandle is associated with which file.  Which leads me to wonder 
about STDIN, STDOUT, STDERR which are the exceptions, they are opened 
for you, but again it seems 'Perl' is the one that has opened them, and 
they may or may not be just pipes from the shell or the tty, and if you 
munge them to point to something new, then again, you should know what 
you have done.

Head beginning to hurtgoing to bed...Hopefully someone with system 
level knowledge can shed some light on this.

http://danconia.org


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Top Posting Preferences (was navigate the directories)

2003-01-09 Thread Randal L. Schwartz
> "Jenda" == Jenda Krynicky <[EMAIL PROTECTED]> writes:

Jenda> Besides. It's NOT top-post versus bottom-post. If you quote a message 
Jenda> properly (for my definition of properly) then your replies are 
Jenda> interspersed with the original message.

Hear, hear.

Jenda> And you should ALWAYS delete evertthing that's not important in the 
Jenda> original. Especialy the signatures.

Exactly.

Jenda> And the reader can see ... to this line he responded with this, to 
Jenda> that line with that, this line of code provoked this remark ...

Exactly.  It's like a conversation.

Curse Redmond for providing a mailer that by default quotes
*everything* and puts the cursor at the *top* of the quoted material.
Or maybe curse the lazy people who didn't realize that the proper
response is then to go down *through* the quoted text, deleting and
answering as needed.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why can't use SQL "GROUP BY..."?

2003-01-09 Thread R. Joseph Newton
It might be worth trying:
"SELECT page FROM '$Table' \nGROUP BY page"
and see what results you get.

Joseph


Gary Fung wrote:

> Hi,
>
>   I have a Perl program using DBI. I don't know why it will cause error when I use 
>"GROUP BY..." in SQL "SELECT" statements.
>
> My coding is similar as:
>
>  $value2 = $dbh->prepare("SELECT page FROM $Table
>
> GROUP BY page") || die "Couldn't add record, ".$dbh->errstr();
>
> Whenever I use "GROUP BY.." , an error statement will go out :
>
> "SQL ERROR: Can't find table names in FROM clause!"
>
> Can anyboby give help to me?
>
> Thank You very much!!
>
> Regards,
>
> Gary
>
> Lonely Christmas(³¯«³¨³)¡A­·ºå»P­·(Twins)¡AµL¶¡¹D(¹q¼v)...
> ¦ÜIn¤â¾÷¹aÁn ³­§A¹L¥V¤Ñ


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  1   2   >