[18244] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 412 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 4 14:05:39 2001

Date: Sun, 4 Mar 2001 11:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983732716-v10-i412@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 4 Mar 2001     Volume: 10 Number: 412

Today's topics:
    Re: #ifndef ???? <mjcarman@home.com>
    Re: a beginner i perl- suiciadal (Randal L. Schwartz)
        Calling Ncftpput from within perl script and getting re <abcd@ntlworld.com>
    Re: Calling Ncftpput from within perl script and gettin <abcd@ntlworld.com>
    Re: check open files ? <gellyfish@gellyfish.com>
    Re: Cut the space (Tad McClellan)
    Re: flock and close   with  empty read strangeness <bart.lateur@skynet.be>
    Re: Global problem with array <iqbals8@cs.man.ac.uk>
    Re: Global problem with array <iqbals8@cs.man.ac.uk>
    Re: Hash/array woes... <scottb@wetcanvas.com>
    Re: HelpOnHashes?!?! <r51446@email.sps.mot.com>
    Re: Is Perl right for me? <bowman@montana.com>
    Re: Is Perl right for me? <godzilla@stomp.stomp.tokyo>
    Re: Is Perl right for me? <parrot0123@yahoo.ca>
    Re: Is Perl right for me? <theaney@toadmail.toad.net>
    Re: Is Perl right for me? <godzilla@stomp.stomp.tokyo>
    Re: Is Perl right for me? (Tad McClellan)
    Re: Is Perl right for me? <parrot0123@yahoo.ca>
    Re: Is Perl right for me? <maximom@mindspring.com>
    Re: Mail::Send and invoking sendmail with -t -f me@here <gellyfish@gellyfish.com>
    Re: milliseconds (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 04 Mar 2001 17:26:39 GMT
From: Michael Carman <mjcarman@home.com>
Subject: Re: #ifndef ????
Message-Id: <3AA27C97.3281975B@home.com>

paul wrote:
> 
> Does Perl have anything like the #ifndef from C++?

As Martien said, that is a compile time directive, you want to do this
at runtime.

> I want to be sure that once a certain very large hash is never 
> loaded more than once. I want to load it once and make a 
> reference available to it globally.

A very simple (if far from obvious) way is to evaluate the hash in
scalar context:

use vars qw(%bighash);

unless (scalar %bighash) {
    %bighash = load_hash();
}

Evaluating a hash in scalar context returns the number of buckets
used/number of buckets allocated. Populated hashes return a string like
'3/8' which means that 3 of 8 buckets have been used. Undefined or empty
hashes return a false value.

-mjc


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

Date: 04 Mar 2001 07:28:04 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: a beginner i perl- suiciadal
Message-Id: <m1itlpimez.fsf@halfdome.holdit.com>

>>>>> "nina" == nina ahlberg <nina.ahlberg@ntlworld.com> writes:

nina> Hello! I'm just sttarting to learn how to program in perl...
nina> and already got stuck. I'm suppose to do a telephone directory,
nina> where the user is simply inputting names and telephonenumbers
nina> until the name is null or the word "none" is used for the name,
nina> after this the system should ask for a name whoes
nina> telephonenumber is required and display the correct number in
nina> case of a match or an error message. if the word "none" is typed
nina> or null is given the program should terminate. SIMPLE!  but
nina> having problems..... my initial attempts...:

Hmm. I smell homework.

"just starting" combined with "supposed to" and a program with
artificial constraints.

Please don't ask for homework help here unless you are honest about
it.  And better yet, just don't do it.  You are supposed to be
learning how to do this on your own.  If you can't get it, ask your
instructor or TA, so that they know how successful you are at grasping
the concepts, and then they can adjust the classroom teaching style to
assist, or perhaps tell you to take a different class if unable.

At least, that's what I'd hope my students do for the University
classes I teach. (See http://www.cse.ogi.edu/courses/OGI503/.)

print "Just another Perl instructor,";

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL: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!


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

Date: Sun, 4 Mar 2001 16:50:01 -0000
From: "Chile" <abcd@ntlworld.com>
Subject: Calling Ncftpput from within perl script and getting return exit value??
Message-Id: <U6uo6.9487$925.897827@news6-win.server.ntlworld.com>

Hi,

Can anyone tell me how i would go about calling ncftpput from within a perl
script.

In fact how do you execute linux commands from within the perl script in
general. eg how would i call ls -all and then print of the dir structure on
a web page??

Thanks,
Scott





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

Date: Sun, 4 Mar 2001 17:07:45 -0000
From: "Chile" <abcd@ntlworld.com>
Subject: Re: Calling Ncftpput from within perl script and getting return exit value??
Message-Id: <jnuo6.9524$925.903782@news6-win.server.ntlworld.com>

its ok i think i have found an article on it.

something like:
@test = 'ncftput .........';

so test has output and command is run.

:Scott

"Chile" <abcd@ntlworld.com> wrote in message
news:U6uo6.9487$925.897827@news6-win.server.ntlworld.com...
> Hi,
>
> Can anyone tell me how i would go about calling ncftpput from within a
perl
> script.
>
> In fact how do you execute linux commands from within the perl script in
> general. eg how would i call ls -all and then print of the dir structure
on
> a web page??
>
> Thanks,
> Scott
>
>
>




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

Date: 4 Mar 2001 13:05:34 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: check open files ?
Message-Id: <97teiu$ogr$1@orpheus.gellyfish.com>

On Sat, 03 Mar 2001 16:19:53 +0100 Joel Nyholm wrote:
> Hello,
> 
> How can i check if a file is open with perl ?
> 

I am assuming you mean 'check if a file is open with a Perl program' rather
than 'check if a file is opened by a Perl program'.  If I assume right
then you will want something like the Unix command fuser - this is a
simple version of fuser in Perl that is rehashed from an earlier one I
had that stopped working with the linux 2.2.12 /proc filesystem :


#!/usr/bin/perl -w

# fuser.pl
# A simple minded fuser command 
# may only work for Linux 2.2.12

use strict;
use Getopt::Std;

my %opt;

getopts('u',\%opt) || die "Invalid argument\n";

@ARGV || die "No file specified \n";

my $rc = 0;

while(my $file = shift @ARGV)
{
    next unless -f $file;
    my @procinfo = ();
    my ( $dev,
         $ino,
         @ostuff ) = stat($file);

    opendir PROC,'/proc' or die "Can't access /proc - $!\n";

    my @procs = grep /^\d+$/, readdir PROC;

    closedir PROC;

    foreach my $proc ( @procs )
    {
      opendir FD,"/proc/$proc/fd" or next;
      
      my @fds = map { "/proc/$proc/fd/$_" } grep /^\d+$/, readdir FD;

      closedir FD;

      foreach my $fd (@fds)
      {

        if (my @statinfo = stat $fd)
        {
           if (($dev == $statinfo[0]) && ($ino == $statinfo[1]) )
           {
             my $user = '';
             if ($opt{u})
             {
               $user = '(' . getpwuid((lstat($fd))[4]) . ')';
             }
             push @procinfo, "${proc}${user}";
             $rc++;
           }
        }
      }
    }
    print "${file}:\t",join( "\t",@procinfo),"\n" if @procinfo;
}
exit $rc;


This would be run as './fuser <filename>' and will return a list of the
processes that have the file open.

As an aside does anyone have any ideas why the </proc/*/fd/*> glob doesnt
work anymore with 5.6.0 and linux 2.2.12 ?  it only returns /proc/self/fd/*
strange ....

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Sun, 4 Mar 2001 11:02:50 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Cut the space
Message-Id: <slrn9a4ppa.1hk.tadmc@tadmc26.august.net>

Ivan Leung <khleung@cse.cuhk.edu.hk> wrote:

>How can I cut the blank space(s) at the end of a string?


The way it says to in the Perl FAQ.


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


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

Date: Sun, 04 Mar 2001 14:47:00 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <qal4atkl819rh00g9t48hhbo5p5vot5u14@4ax.com>

Alan J. Flavell wrote:

>> Now, you can do:
>>
>> 	open FILE, ">>$file";
>> 	open FILE, "+<$file";
>>
>> which opens the file twice in a row, the first time creating the file if
>> it didn't exist, and automatically closing it when opening it for the
>> second time.
>
>But how would that jive with flocking?

Huh? ">>" is not a problem, is it? It never clears a file, it only makes
sure it will exist. And "+<" behaves as before.

-- 
	Bart.


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

Date: Sun, 04 Mar 2001 14:54:30 +0000
From: Shazad Iqbal <iqbals8@cs.man.ac.uk>
Subject: Re: Global problem with array
Message-Id: <3AA25726.C77915E5@cs.man.ac.uk>

Thanks alot Ill have ago at what i have done wrong much appreciated
Mahesh
Mahesh A wrote:
> 
> > #!/opt/perl/bin/perl -w
> > use strict;
> >
> > my $line;
> > my $Semester;
> > my $Day;
> > my $StartTime;
> > my $Type;
> > my $Week;
> > my $Course;
> > my $Group;
> > my $Room;
> > my @Semester;
> > my @Day;
> > my @StartTime;
> > my @Type;
> > my @Week;
> > my @Course;
> > my @Group;
> > my @Room;
> > my $index;
> > open USER, "table_pr"or die "Could not open file: $:";
> >   # e.g. line
> >   # 1    MONDAY 11.00 L  Wa ab103_X   Wind  - AJWest PCCapon JSANDHAM
> >   # Sem    Day  Time Typ Wk  Crs Grp   Rm   - Rest
> >
> >   foreach $line (<USER>)
> >   {
> >     chomp $line;
> >     if ( $line =~ m{^([12]) # sem
> >    \s
> 
> I had to make this \s+ to match the pattern, and gwt into the 'if'
> 
> >    (\S+) # day
> >    \s+
> >    ([0-9]+\.[0-9]+) # Time
> >    \s
> >    (\S) # type
> >    \s+
> >    (\S+) # week
> >    \s
> >    ([^_ ]+)(|_\S*) # course and group
> >    \s+
> >    (\S+) # room
> >    \s+
> >    (-.*)}x # ignore
> >        )
> >      {
> >       @Semester=$1;
> >       @Day=$2;
> >       @StartTime=$3;
> >       @Type=$4;
> >       @Week=$5;
> >       @Course=$6;
> >       @Group=$7;
> >       @Room=$8;
> 
> I'd rather use...
>          push(@Semester,$1);
>          push(@Day,$2);
>          push(@StartTime,$3);
>          push(@Type,$4);
>          push(@Week,$5);
>          push(@Course,$6);
>          push(@Group,$7);
>          push(@Room,$8);
> than t your assignments.
> 
> >      }
> >    print "Courses @Course\t and it days @Day\t at the time @StartTime in
> > room @Room\n";
> >   }
> >
> >    print "what module do u want information of?\n\n";
> >    my $module_choice = <STDIN>;
> >    chomp $module_choice;
> >    print "The module you choice $module_choice\n";
> >
> >    for ($index=0; $index <= $#Course; $index++)
> >    {
> >     if ( $Course[$index] =~ /$module_choice/)
> >     {
> > print " the module happens on $Day[$index], at $StartTime[$index].
> > The module is $Type[$index] in room $Room[$index]\n\n";
> > last;
> >     }
> >    else { print "You have not typed in an incorrect module\n";}
> 
> I dont think this is a proper message here.
> 
> >    }
> >    close USER;
> >
> >
> > Any help would be much appreciated.
> >
> > SHazad iqbal
> 
> My modifications ...
> 
> #!/opt/perl/bin/perl -w
> use strict;
> 
> my $line;
> my $Semester;
> my $Day;
> my $StartTime;
> my $Type;
> my $Week;
> my $Course;
> my $Group;
> my $Room;
> my @Semester;
> my @Day;
> my @StartTime;
> my @Type;
> my @Week;
> my @Course;
> my @Group;
> my @Room;
> my $index;
> $| = 1;
> # open (DATA, "table_pr") || die "Could not open file: $:";
> # e.g. line
> # 1    MONDAY 11.00 L  Wa ab103_X   Wind  - AJWest PCCapon JSANDHAM
> # Sem    Day  Time Typ Wk  Crs Grp   Rm   - Rest
> 
> while (<DATA>)
> {
>     chomp;
> 
>     if ( m{^([12]) # sem
>     \s+
>     (\S+) # day
>     \s+
>     ([0-9]+\.[0-9]+) # Time
>     \s
>     (\S) # type
>     \s+
>     (\S+) # week
>     \s
>     ([^_ ]+)(|_\S*) # course and group
>    # (\S+)_(\S*) # course and group
>     \s+
>     (\S+) # room
>     \s+
>     (-.*)
> }x # ignore
>         )
>     {
>         push(@Semester,$1);
>         push(@Day,$2);
>         push(@StartTime,$3);
>         push(@Type,$4);
>         push(@Week,$5);
>         push(@Course,$6);
>         push(@Group,$7);
>         push(@Room,$8);
>     }
>     print "Courses $6\t and it days $2\t at the time $3 in room $8\n";
> }
> 
> print "what module do u want information of?\n\n";
> my $module_choice = <STDIN>;
> chomp $module_choice;
> print "The module you choice $module_choice\n";
> 
> my $match = 0;
> 
> for ($index=0; $index <= $#Course; $index++)
> {
>     if ( $Course[$index] =~ /$module_choice/)
>     {
>         $match = 1;
>         print " the module happens on $Day[$index], at $StartTime[$index].
>  The module is $Type[$index] in room $Room[$index]\n\n";
>         last;
>     }
> }
> if (!$match) { print "You have not typed in an incorrect module\n";}
> 
> close DATA;
> 
> __DATA__
> 1    MONDAY 11.00 L  Wa ab101_X   Wind  - AJWest PCCapon JSANDHAM
> 2    MONDAY 11.00 L  Wa ab102_X   Wind  - AJWest PCCapon JSANDHAM
> 1    MONDAY 11.00 L  Wa ab103_X   Wind  - AJWest PCCapon JSANDHAM
> 2    MONDAY 11.00 L  Wa ab104_X   Wind  - AJWest PCCapon JSANDHAM
> 
> ... Output ....
> % perl arrays.pl
> Courses ab101  and it days MONDAY  at the time 11.00 in room Wind
> Courses ab102  and it days MONDAY  at the time 11.00 in room Wind
> Courses ab103  and it days MONDAY  at the time 11.00 in room Wind
> Courses ab104  and it days MONDAY  at the time 11.00 in room Wind
> what module do u want information of?
> 
> ab104
> The module you choice ab104
>  the module happens on MONDAY, at 11.00.
>  The module is L in room Wind


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

Date: Sun, 04 Mar 2001 14:55:01 +0000
From: Shazad Iqbal <iqbals8@cs.man.ac.uk>
Subject: Re: Global problem with array
Message-Id: <3AA25745.AAEC8052@cs.man.ac.uk>

Thanks alot Ill have ago at what i have done wrong much appreciated
Michael.
Michael Carman wrote:
> 
> Shazad Iqbal wrote:
> >
> > I have just started using perl on a piece of work. What I want to do is
> > read the file and assign what I find to variables which are declared
> > global.
> 
> Semantic point: You don't have any global variables in your script. my()
> variables are lexical -- scoped to the enclosing block (or file, in this
> case).
> 
> > But when I use a variable outside the for loop, it doesnt recognise it.
> 
> Can you tell us which variable or do we have to dig it out ourselves?
> 
> > The code is below could anyone see what I am doin wrong.
> 
> > #!/opt/perl/bin/perl -w
> > use strict;
> 
> So far, so good!
> 
> > my $line;
> > my $Semester;
> > my $Day;
> > my $StartTime;
> > my $Type;
> > my $Week;
> > my $Course;
> > my $Group;
> > my $Room;
> > my @Semester;
> > my @Day;
> > my @StartTime;
> > my @Type;
> > my @Week;
> > my @Course;
> > my @Group;
> > my @Room;
> > my $index;
> 
> You can define more than one variable in a my():
> 
> my (@Semester, @Day, @StartTime, ...);
> 
> And don't declare things you never use. ($Semester, $Day, etc.)
> 
> Stylistic point: Most programmers disdain the use of 'StudlyCaps' and
> use all lowercase for most variables, ALL_CAPS for globals, and
> Title_Case for (most) subroutines.
> 
> > open USER, "table_pr"or die "Could not open file: $:";
>                                                     ^^
> Good to see that you're checking the return of open(), but you want $!
> here, not $:
> 
> >   # e.g. line
> >   # 1    MONDAY 11.00 L  Wa ab103_X   Wind  - AJWest PCCapon JSANDHAM
> >   # Sem    Day  Time Typ Wk  Crs Grp   Rm   - Rest
> >
> >   foreach $line (<USER>)
> >   {
> >     chomp $line;
> >     if ( $line =~ m{^([12])     # sem
> >                    \s
> >                    (\S+)        # day
> >                    \s+
> >                    ([0-9]+\.[0-9]+) # Time
> >                    \s
> >                    (\S)         # type
> >                    \s+
> >                    (\S+)        # week
> >                    \s
> >                    ([^_ ]+)(|_\S*) # course and group
> >                    \s+
> >                    (\S+)        # room
> >                    \s+
> >                    (-.*)}x      # ignore
> >        )
> 
> That's a lot of work to split on whitespace. Why not use split()
> instead?
> 
> my @fields = split(/\s+/, $line);
> 
> >      {
> >       @Semester=$1;
> >       @Day=$2;
> >       @StartTime=$3;
> >       @Type=$4;
> >       @Week=$5;
> >       @Course=$6;
> >       @Group=$7;
> >       @Room=$8;
> >      }
> 
> Ack! Don't assign a scalar to an array! Either 1) use a scalar variable
> if that's what you want or 2) use push() to add an element to an array.
> 
> >    print "Courses @Course\t and it days @Day\t at the time @StartTime in
> > room @Room\n";
> >   }
> 
> Again, don't use an array where you want a scalar.
> 
> >    print "what module do u want information of?\n\n";
> >    my $module_choice = <STDIN>;
> >    chomp $module_choice;
> >    print "The module you choice $module_choice\n";
> >
> >    for ($index=0; $index <= $#Course; $index++)
> >    {
> >     if ( $Course[$index] =~ /$module_choice/)
> 
> The Perlish way of doing this would be:
> 
> foreach my $course (@Course) {
>     if ($course eq $module_choice) {
>         #...
> 
> But since you clobbered @Course every pass through the loop, you only
> have one element in the array and (therefore) nothing to loop through. I
> guess that means you wanted approach 2) above. Actually, I think what
> you really want is a hash. Here's how my first crack at it would look:
> 
> #!/usr/local/bin/perl5 -w
> use strict;
> 
> my %course_info;
> 
> while (<DATA>) {
>     chomp;
>     my ($sem, $day, $time, $type, $week, $course, $room, undef) = split;
> 
>     $course_info{$course} = {
>         semester => $sem,
>         day      => $day,
>         'time'   => $time,
>         type     => $type,
>         week     => $week,
>         room     => $room,
>     };
> 
>    print "Course $course is on $day at $time in room $room\n";
> }
> 
> print "What module do you want information on?\n";
> chomp(my $choice = <STDIN>);
> print "You chose is module $choice\n";
> 
> if ($course_info{$choice}) {
>     printf("The module happens on %s, at %s.\n",
>         $course_info{$choice}{day},
>         $course_info{$choice}{'time'});
>     printf("The module is %s in room %s\n\n",
>         $course_info{$choice}{type},
>         $course_info{$choice}{room});
> }
> else {
>     print "You have not selected in a valid module.\n";
> }
> 
> __DATA__
> 1    MONDAY   11.00 L  Wa ab101_X   Wind  - AJWest PCCapon JSANDHAM
> 2    TUESDAY  11.00 L  Wa ab102_X   Wind  - AJWest PCCapon JSANDHAM
> 1    THURSDAY 11.00 L  Wa ab103_X   Wind  - AJWest PCCapon JSANDHAM
> 2    FRIDAY   11.00 L  Wa ab104_X   Wind  - AJWest PCCapon JSANDHAM
> 
> -mjc


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

Date: Sun, 04 Mar 2001 10:46:15 -0800
From: Scott Burkett <scottb@wetcanvas.com>
Subject: Re: Hash/array woes...
Message-Id: <3AA28D77.FE18DE6C@wetcanvas.com>


For those interested in a solution ... after some more diligence online, I
came across a fabulous package to do this very thing.  It's called
DBIx::Tree.  Available on cpan.

Cheers.
Scott



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

Date: Sun, 04 Mar 2001 09:58:18 -0700
From: Robert Joost <r51446@email.sps.mot.com>
Subject: Re: HelpOnHashes?!?!
Message-Id: <3AA2742A.A498AAB1@email.sps.mot.com>

This is a multi-part message in MIME format.
--------------5FF3E6D22DF98BBFD2567416
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The learning curve was kind of steep for me, but it's making sense, thanks!




Robert Joost wrote:

> RTFM, yes. I want to open a directory, get the list of tickets, all of
> which are of the format, for example,  2001-03-01-16:08:52.outage  ( the
> file names = savefile ( field in the ticket))
> After reading in that directory and setting the contents up in an array,
> @outages, I want to open a Report and append the contents of *.outage
> to that report. For all the outage tickets in the directory being
> opened, each ticket consists several fields---
> # cat 2001-02-22-22:19:32.outage
> userid=rxxxxx
> date=22%20Feb%202001%201550
> duration=3%20min
> remedy=
> server=prodserver
> app=Static_Site
> description=adsfadfadsfasdfasdfadfadfa%0D%0A%0D%0Ad
> savefile=adsfadfadsfasdfasdfadfadfa%0D%0A%0D%0Ad
> action=SAVE
> =
>
> I want to split each line off into key/value pairs, but what I am
> scouring the net/faqs/books/mags for is how to
> make the hash write out  to Report like this --  ( without action=SAVE
> and = )
> rxxxxx    22 Feb 2001  1550     20min     prodserver
> Static_Site     adsfadfadsfasdfasdfadfadfad adsfadfadsfasdfasdfadfadfa
>
> in tab-delimited fields ??
>
> sub report_parameters {
> #use diagnostics;
> opendir(TICKETS, "/usr/local/apache/htdocs/outages/tickets");   #open
> the directory with the files
>   my @outages = readdir(TICKETS);   # set up the array of files
> closedir(TICKETS);
>
> open(REPORT, ">>/usr/local/apache/htdocs/outages/Report");   # open the
> Report for append
> foreach $outage (@outages) {   #for each file
>   open(TICKET, "/usr/local/apache/htdocs/outages/tickets/$outage");   #
> open the file
>   while ($line = <TICKET>) {    #iterate over the line in each file
> (each file has only one line)
>        chomp $line;
>        ($key, $val) = split /=/, $line;   # split the line by "=" for
> key/value pairs
>        $config{$key} = $val;  # get the value
>
>    }
>   print "\n";
>   print REPORT "$config{$val}";   # print to Report the value in
> tab-delimited format
>   close(REPORT);
>   close(TICKET);
> }
> }
>
> I have tried numerous possiblities, but everytime I click on the submit
> button that calls this procedure, the Report file is not touched at all
> (Solaris env), perl 5, use CGI....
> I have no problem in this script to grab all the fields and to create
> the tickets, and, I can create this Report no problem with the field
> variables, but, I just can't get an iteration
> like this to build the report. Note that the filename = savefile, so
> that could server as some kind of a primary key.
> I am turning to people now for help. I am a new inductee into perl and
> love it, having graduated from korn shell out of necessity!
> I have come across tons of ideas, like hashes of hashes, dbm, etc, etc,
> so please only respond if you can just help me out.
>
> Thanks!!!

--------------5FF3E6D22DF98BBFD2567416
Content-Type: text/x-vcard; charset=us-ascii;
 name="r51446.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Robert Joost
Content-Disposition: attachment;
 filename="r51446.vcf"

begin:vcard 
n:Joost;Robert
x-mozilla-html:FALSE
org:Motorola Semiconductor Product Sector;e-Business Infrastructure & Operations
adr:;;;;;;
version:2.1
email;internet:Robert.Joost@Motorola.com
title:Systems Engineer
note;quoted-printable:The supreme happiness of life is the conviction that we are loved.=0D=0A                                Victor Hugo (in Les Miserables)
x-mozilla-cpt:;-8032
fn:Robert Joost
end:vcard

--------------5FF3E6D22DF98BBFD2567416--



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

Date: Sun, 4 Mar 2001 06:39:46 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: Is Perl right for me?
Message-Id: <qDso6.1889$G54.1289@newsfeed.slurp.net>


Bart Lateur <bart.lateur@skynet.be> wrote in message
news:e2g4atgl5ek67e37quvv6h0t48cem12b5i@4ax.com...
> Holly Bortfeld wrote:
>
> >I can write HTML
> >from scratch without an editor.
>
> Wow, that is strong. So how do you write HTML? Using a speech
> recognition system?

real men write web pages with

cat > foo.html






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

Date: Sun, 04 Mar 2001 08:00:58 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Is Perl right for me?
Message-Id: <3AA266BA.C77F5D1@stomp.stomp.tokyo>

Parrot wrote:

> Godzilla! wrote:

> > Perl is not right for you. To write an effective and efficient
> > program to accomplish your task, you will need a minimum of
> > one year's worth of intensive working experience with Perl.
> > Learning Perl itself, will take you at least a year as well.

> Oh Come On! - I was able to learn the basics of Perl in a day,


(snipped)


I am quite certain you are exceptionally well endowed,
could take down China within thirty seconds and can
polish off a twelve pack before halftime.


Godzilla!
-- 
@ø=(a .. z);@Ø=qw(6 14 3 25 8 11 11 0 17 14 2 10 18);
$§="\n";$ß="\b";undef$©;print$§x($Ø[4]/2);
for($¡=0;$¡<=$Ø[2];$¡++){foreach$¶(@Ø){
$ø[$¶]=~tr/A-Z/a-z/;if(($¡==1)||($¡==$Ø[2]))
{$ø[$¶]=~tr/a-z/A-Z/;}print$ø[$¶];if($¶==0)
{print" ";}if($¶==$Ø[12]){print" !";}&D;}
print$ßx($Ø[4]*2);}print$§x($Ø[10]*2);
sub D{select$©,$©,$©,.25;}exit;


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

Date: Sun, 04 Mar 2001 16:34:30 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Is Perl right for me?
Message-Id: <q8uo6.336392$f36.11844109@news20.bellglobal.com>


Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:3AA266BA.C77F5D1@stomp.stomp.tokyo...
>
> I am quite certain you are exceptionally well endowed,
> could take down China within thirty seconds and can
> polish off a twelve pack before halftime.
>

Well, of course that's all true - it's good to find somebody who realizes
how brilliant I am! :)





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

Date: 04 Mar 2001 11:50:21 -0500
From: Tim Heaney <theaney@toadmail.toad.net>
Subject: Re: Is Perl right for me?
Message-Id: <87k865fpgy.fsf@susie.watterson>

"bowman" <bowman@montana.com> writes:
>
> Bart Lateur <bart.lateur@skynet.be> wrote in message
> news:e2g4atgl5ek67e37quvv6h0t48cem12b5i@4ax.com...
> > Holly Bortfeld wrote:
> >
> > >I can write HTML
> > >from scratch without an editor.
> >
> > Wow, that is strong. So how do you write HTML? Using a speech
> > recognition system?
> 
> real men write web pages with
> 
> cat > foo.html

You mean with a keyboard? Wuss.

  http://ars.userfriendly.org/cartoons/?id=19990508


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

Date: Sun, 04 Mar 2001 08:53:15 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Is Perl right for me?
Message-Id: <3AA272FB.8B06360@stomp.stomp.tokyo>

Parrot wrote:

 
> Godzilla! wrote:
> > Parrot wrote:

> > >  Oh Come On! - I was able to learn the basics of Perl in a day,

> > (snipped)

> > I am quite certain you are exceptionally well endowed,
> > could take down China within thirty seconds and can
> > polish off a twelve pack before halftime.

> Well, of course that's all true - it's good to find
> somebody who realizes how brilliant I am! :)


I have made no direct comment regarding your
relative intellectual capacity.

Many decades back I also realized Neandertal man
is far from extinct.

Godzilla!


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

Date: Sun, 4 Mar 2001 10:11:18 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Is Perl right for me?
Message-Id: <slrn9a4mom.1hk.tadmc@tadmc26.august.net>

Holly Bortfeld <maximom@mindspring.com> wrote:
>Hi, thanks for writing.  Please see my responses interspersed below.
>
>"Tad McClellan" <tadmc@augustmail.com> wrote in message
>news:slrn9a2sbr.qel.tadmc@tadmc26.august.net...
>> Holly Bortfeld <maximom@mindspring.com> wrote:
>> > >I want to create a website for parents of kids with multiple food
>allergies
>> >that allows users to click boxes as to what thier child cannot have in a
>> >recipe, then the search engine or script would sort through the 25,000+
>> >tagged recipes to show the site user only the recipes that fit their
>entered
>>  ^^^^^^
>>
>My understanding of this is that each recipe file would have on it a tag
>that the search engine would find. The tags would be something like
>WF,GF,CF,MF,NF (etc) to mean wheat free, gluten free, corn free, milk free,
>nut free.  so the engine would only pull up recipes that included those
>items in the tag.  The actual information in the file below the tag would
>not matter to the search engine as I would instruct it only to files that
>had the right tag assigned and not search the text of the whole file.


Good, you _have_ thought of such issues then.


>Am I way off?  


No. It is now sounding like a rather straight-forward SMOP
(Simple Matter Of Programming) that shouldn't be too hard
in any of several programming languages.


>Perl is starting to look like something I want to learn
>either way as it seems to fit with every platform so it may be good to learn
>regardless.


Learn enough Perl to get this done yourself. 

Ask for help here when you get stuck (see the Posting Guidelines
beforehand if you like:    http://dfw.pm.org/clpmisc.shtml).



[ The Posting Guidelines aren't quite ready for auto-posting to
  the newsgroup yet. I hope to get that done next week.
]


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


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

Date: Sun, 04 Mar 2001 17:15:36 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Is Perl right for me?
Message-Id: <YKuo6.336532$f36.11847745@news20.bellglobal.com>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:3AA272FB.8B06360@stomp.stomp.tokyo...
>
> I have made no direct comment regarding your
> relative intellectual capacity.
>
The word 'brilliant' often refers to more than just intelectual capacity,
you know.  It's proper intent would be to comment that an individual is
extremely skilled in a certain area, and is not limited to the category of
intelligence.

Of course, I know you think I'm intellectually brilliant as well - thanks
for the great compliment.  I'm blushing. ;)




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

Date: Sun, 4 Mar 2001 13:47:55 -0500
From: "Holly Bortfeld" <maximom@mindspring.com>
Subject: Re: Is Perl right for me?
Message-Id: <97u28j$dvr$1@slb6.atl.mindspring.net>

Obviously I meant without using programs like FrontPage.  I learned HTML in
2 weeks while concurrently creating my first 22-page site so I am confident
I can learn Perl now that I know it will do what I need.  I have some more
research to do, obviously, but can you tell me if there is a newsgroup or
email-based group for newbies, since I have been emailed by a number of
people telling me this was off-topic for this group.

Holly

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:e2g4atgl5ek67e37quvv6h0t48cem12b5i@4ax.com...
> Holly Bortfeld wrote:
>
> >I can write HTML
> >from scratch without an editor.
>
> Wow, that is strong. So how do you write HTML? Using a speech
> recognition system?
>
> >I want to create a website for parents of kids with multiple food
allergies
> >that allows users to click boxes as to what thier child cannot have in a
> >recipe, then the search engine or script would sort through the 25,000+
> >tagged recipes to show the site user only the recipes that fit their
entered
> >criteria in a particular category.
> >The site does not need to be fancy with pictures or Java, just efficient
to
> >sort through the vast amounts of recipe files in a short amount of time.
>
> If this could be described in terms of SQL, then any language that can
> access an SQL database from within a CGI script (or similar) will do.
> I'd suggest using PHP, at least it's free. ColdFusion is rather
> expensive.
>
> If that's not good enough, then maybe you do need Perl.
>
> >At
> >CompUSA, a young man suggested DreamWeaver but the description on the
site
> >does not look like that will fit my needs.
>
> Ooh, no. I think Dream Weaver is NOTHING BUT a WYSIWYG HTML editor.
>
> --
> Bart.




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

Date: 4 Mar 2001 13:28:14 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Mail::Send and invoking sendmail with -t -f me@here.com
Message-Id: <97tfte$ol9$1@orpheus.gellyfish.com>

On Sat, 3 Mar 2001 19:59:06 +0000 Saeed Rana wrote:
> Hi,
> 
> We have a web app that offers email. It has been written using
> Mail::Send to send emails. The MTA is sendmail. The mails are sent
> virtual domains, and we want the virtual domain names to be shown in the
> return path. To do this, sendmail offers the -f command line flag. Now,
> the question is, how can we, when calling Mail:Send to open up a new
> sendmail object, tell it to invoke sendmail with -f <from_address>.
> 

No problem you can do that easily although it isnt documented - Mail::Send
will pass on any extra arguments to the open() method straight through to
the constructor of Mail::Mailer which will in turn pass them on to
Mail::Mailer::sendmail which does the work - so :


require Mail::Send;


my $mail = Mail::Send->new( Subject => 'test', To => 'gellyfish');

my $fh = $mail->open('sendmail',,'-f Foo@foo.com');

print $fh 'test';

$fh->close();


will do what you want.

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Mon, 5 Mar 2001 01:29:47 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: milliseconds
Message-Id: <slrn9a4kar.5vn.mgjv@martien.heliotrope.home>

On Fri, 2 Mar 2001 12:10:08 +0100,
	Arthur Wolst <awolst@lodderapplicaties.nl> wrote:
> Is there any other function available to get the exact time values with
> milliseconds?

Found in the Perl FAQ, section 8 (with perldoc -q second)

       How can I measure time under a second?

You don't mention the pltform you're on, but the answer there is quite
platform specific. In general, there is no answer to that, in Perl. You
may be able to use one of the methods advices there, or maybe another
method that's specific to your platform.

Alternatively, do what is often done in benchmarking: repeat your
loop/code/request many times, and divide the total time by the number of
times requested. When doing this sort of stuff against a database, you
should be really careful to take caching and stuff like that into
account, if you can.

Benchmarking is an art. Be sure to know what you're measuring before you
start relying on the numbers you generate.

Martien
-- 
Martien Verbruggen              | The Second Law of Thermodenial: In
Interactive Media Division      | any closed mind the quantity of
Commercial Dynamics Pty. Ltd.   | ignorance remains constant or
NSW, Australia                  | increases.


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


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


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