[17322] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4744 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 27 14:10:34 2000

Date: Fri, 27 Oct 2000 11:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972670217-v9-i4744@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 27 Oct 2000     Volume: 9 Number: 4744

Today's topics:
    Re: in an eval, redirect STDOUT to a variable (Tom Christiansen)
    Re: in an eval, redirect STDOUT to a variable (Tom Christiansen)
        Is there a better way to get "the element before $x" in (Mary Ellen Foster)
    Re: Is there a better way to get "the element before $x <ren.maddox@tivoli.com>
        Is there an active php group? </michael>
    Re: jpeg image manipulation ejehoel@my-deja.com
    Re: jpeg image manipulation (Al)
    Re: Legal email addresses... (Al)
    Re: Linked lists (Tad McClellan)
        looking for speech recognition evaluator in perl <Gina.Joue@ucd.ie>
    Re: looking for speech recognition evaluator in perl nobull@mail.com
    Re: Matching and removing multiline block in perl 1-lin (Tad McClellan)
    Re: Matching and removing multiline block in perl 1-lin nobull@mail.com
        NT displaying and not not running .pl scripts philip_nicholas@my-deja.com
    Re: NT displaying and not not running .pl scripts <latsharj@my-deja.com>
        ODBC - Newbie having connection/setup problem (P&C)
    Re: Open URL as file (Tad McClellan)
    Re: operators <josef.moellers@fujitsu-siemens.com>
    Re: Perl on NT <camerond@mail.uca.edu>
    Re: Removing line breaks from a string - HELP! alphazerozero@my-deja.com
    Re: Removing line breaks from a string - HELP! alphazerozero@my-deja.com
    Re: Removing line breaks from a string - HELP! alphazerozero@my-deja.com
    Re: Removing line breaks from a string - HELP! alphazerozero@my-deja.com
    Re: Removing line breaks from a string - HELP! <godzilla@stomp.stomp.tokyo>
        Resolved: How can I word wrap on STDOUT? <eric.kort@vai.org>
    Re: stat / inode question <elaine@chaos.wustl.edu>
    Re: stat / inode question nobull@mail.com
    Re: what does /warn "$x" if "$x"/ mean (Craig Berry)
    Re: What's wrong with this regex? (Tad McClellan)
    Re: What's wrong with this regex? <ren.maddox@tivoli.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 27 Oct 2000 07:51:25 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: in an eval, redirect STDOUT to a variable
Message-Id: <39f9885d@cs.colorado.edu>

In article <8taruq$mgd$1@nnrp1.deja.com>,
Dave Brondsema  <brondsem@my-deja.com> wrote:
>I get:
>Can't use an undefined value as filehandle reference at test.pl line
>33.  (First line of sub).  I'm running windows if it makes any
>difference.  What is the $self variable?

You probably aren't running with a recent enough version of
Perl for filehandle autovivification.

--tom


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

Date: 27 Oct 2000 08:08:19 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: in an eval, redirect STDOUT to a variable
Message-Id: <39f98c53@cs.colorado.edu>

In article <39F8FB4E.641239CC@vpservices.com>,
Jeff Zucker  <jeff@vpservices.com> wrote:
>Dave Brondsema wrote:
>> 
>> I have a string that I've read from a file.  Then I eval( it.  Is there
>> any way to change it so that the print statements don't print to STDOUT
>> but rather to a string.
>
>At the risk of drawing Tom's ire for suggesting a module, try:

Tsk--you really should have mentioned that this is not a standard
module, but a CPAN one.

>  use IO::Scalar;
>  my $str;
>  my $io = tie *STDOUT, 'IO::Scalar', \$str; 
>  print 'Hello, world';  # "prints" to $str                    
>  undef $io;
>  untie *STDOUT;
>  print "\n[$str]\n";    # print to screen

First of all, the undef+untie is a tricky, and you'll have to be
careful.  More importantly, though, you'll find that that will not
work for arbitrary output emitting statements.  For example:

    use IO::Scalar;
    my $str;
    my $io = tie *STDOUT, 'IO::Scalar', \$str; 
    system "pwd";
    undef $io;
    untie *STDOUT;
    print "\n[$str]\n";    # print to screen

Notice how the code above in no fashion serves to trap that pwd
command's output.  The equivalent using my approach, however, does
do so correctly:

    sub forksub(&) {
        my $kidpid = open my $self, "-|";
        defined $kidpid         || die "cannot fork: $!";
        shift->(@_), exit       unless $kidpid;
        local $/                unless wantarray;
        return <$self>;
    }

    $string = 'system "pwd"';
    $content = '';
    $content .= forksub { eval $string };
    print "Content now <$content>\n";

Or, more directly than using the eval in the original problem,

    $content = '';
    $content .= forksub { system "pwd" };
    print "Content now <$content>\n";

You can enchant *main::STDOUT{IO} all you want, but until and unless
you should actually do something to fileno(STDOUT), you aren't ever
really touching it in a way meaningful to the real world--you know,
the one outside of your program.  Whether this should matter in the
specific case the original poster posed I cannot say, but in the
general case, it most certainly does.  (And reading code in from a
file and evaluating it sure sounds rather general to me.)

--tom


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

Date: 27 Oct 2000 16:10:41 GMT
From: mef@cogsci.ed.ac.uk (Mary Ellen Foster)
Subject: Is there a better way to get "the element before $x" in an array?
Message-Id: <8tc9e1$1hah$1@pc-news.cogsci.ed.ac.uk>

I was just fooling around with a program to do "previous" and "next" links
on a set of web pages. Basically, I look for the current page in the
directory list, and then display the page either directly before it or
directly after it in the listing (the pages are to be shown in alphabetical
order, conveniently).

Here's how I ended up doing it (pared down from the real script). Note that
this was just a five-minute hack, but I am still curious if there's a
better way:

    my $cur_letter = "1234.html";
    my @letters = <*.html>;
    for my $i ( 0 .. $#letters ) {
        if( $letters[$i] eq $cur_letter ) {
            my $new_i = $i;
            if( $command eq "prev" && $i > 0 ) {
                $new_i--;
            } elsif( $command eq "next" && $i < $#letters ) {
                $new_i++;
            }
            print "Location: $base_url$letters[$new_i]\n\n";
            exit;
        }
    }

Using $i like that just offends my aesthetic sensibilities somehow... but I
couldn't see a neat way to use "grep" or something else of that sort on
this task.

Thanks for any suggestions,

MEF

-- 
Mary Ellen Foster  /  ICCS  /  Informatics  /  University of Edinburgh
mef@cogsci.ed.ac.uk         http://www.iccs.informatics.ed.ac.uk/~mef/
-------------------- Law of Software Envelopment: --------------------
        Every program attempts to expand until it can read mail. 


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

Date: 27 Oct 2000 11:34:45 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Is there a better way to get "the element before $x" in an array?
Message-Id: <m3og06qm3e.fsf@dhcp11-177.support.tivoli.com>

mef@cogsci.ed.ac.uk (Mary Ellen Foster) writes:

> I was just fooling around with a program to do "previous" and "next" links
> on a set of web pages. Basically, I look for the current page in the
> directory list, and then display the page either directly before it or
> directly after it in the listing (the pages are to be shown in alphabetical
> order, conveniently).
> 
> Here's how I ended up doing it (pared down from the real script). Note that
> this was just a five-minute hack, but I am still curious if there's a
> better way:
> 
>     my $cur_letter = "1234.html";
>     my @letters = <*.html>;
>     for my $i ( 0 .. $#letters ) {
>         if( $letters[$i] eq $cur_letter ) {
>             my $new_i = $i;
>             if( $command eq "prev" && $i > 0 ) {
>                 $new_i--;
>             } elsif( $command eq "next" && $i < $#letters ) {
>                 $new_i++;
>             }
>             print "Location: $base_url$letters[$new_i]\n\n";
>             exit;
>         }
>     }
> 
> Using $i like that just offends my aesthetic sensibilities somehow... but I
> couldn't see a neat way to use "grep" or something else of that sort on
> this task.

Well, if you are really going to exit, then you could use "grep".
Otherwise, since there is no way to abort a "grep" partially through,
then a loop is better.  You can easily avoid the loop counter with:

my $cur_letter = "1234.html";
my $prev_letter;
for my $letter (<*.html>) {
  if ($command eq "next" && $prev_letter eq $cur_letter) {
      print "Location: $base_url$letter\n\n";
      last;
  }
  if ($command eq "prev" && $letter eq $cur_letter) {
      print "Location: $base_url$prev_letter\n\n";
      last;
  }
}

-- 
Ren Maddox
ren@tivoli.com


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

Date: Fri, 27 Oct 2000 13:25:27 -0400
From: </michael>
Subject: Is there an active php group?
Message-Id: <fjejvs8cqbaqj8lgt7n02u84ntbideefk9@4ax.com>




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

Date: Fri, 27 Oct 2000 14:06:29 GMT
From: ejehoel@my-deja.com
Subject: Re: jpeg image manipulation
Message-Id: <8tc24v$jqs$1@nnrp1.deja.com>

Thank you, I´ve been waiting for your permission!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 27 Oct 2000 15:07:19 GMT
From: nospamapgraham@ispchannel.com--- (Al)
Subject: Re: jpeg image manipulation
Message-Id: <39fa9a11.83608216@news.ispchannel.com>

On Thu, 26 Oct 2000 23:26:06 GMT, mgjv@tradingpost.com.au (Martien
Verbruggen) wrote:


>> >
>> Which should I use to check the pixel width of a jpg uploaded with
>> CGI.pm? I wrote a web page generation script which allows users to
>> fill in a form, chose a template, and have the page made for the. It
>> allows them to upload a logo in the form and I'd like to check to make
>> sure that the image is max 300 pix wide.
>
>If all you're ever going to do is look at width and height of image
>files, use Image::Size. 
>
>If you need to do more than that, you can use Image::Magick's Ping()
>method, or GD's getBounds() method. All are usable. Image::Size will
>have a lower impact than Image::Magick, although the developers are
>working on making Image::Magick less demanding. Image::Size will need
>less memory than GD, because it doesn't have to read (and parse) in
>the whole image to get that information.  Both Image::Size and
>Image::Magick->Ping() just look at the file's signature. GD will need
>to read the image. 
>
>What you use depends mainly on what else you need to do besides
>looking at the size. If you're going to load it in IM or GD anyway,
>you might as well get the size from them. If not, Image::Size is the
>way to go.
>
 Now I've got to learn to read don't I? Damn!
Thanks
-Al-


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

Date: Fri, 27 Oct 2000 14:58:45 GMT
From: nospamapgraham@ispchannel.com--- (Al)
Subject: Re: Legal email addresses...
Message-Id: <39f997c7.83022120@news.ispchannel.com>

On Fri, 27 Oct 2000 05:05:17 GMT,
mcafee@waits.facilities.med.umich.edu (Sean McAfee) wrote:


>
>>Comments ARE allowed in the local part (before the @).
>>Please educate my with a more specific ref.
>
>Section 3.4.3, "COMMENTS":
>
>>The comment construct permits message originators to add text which
>>will be useful for human readers, but which will be ignored by the
>>formal semantics.                                   ^^^^^^^^^^^^^^
> ^^^^^^^^^^^^^^^^
>(Emphasis added.)  And later:
>
>>When a comment acts as the delimiter between a sequence of two lexical
>>symbols, such as two atoms, it is lexically equivalent with a single
>>SPACE...
>
>Satisfied?
More than satisfied. Thank you. I get more education in threads
started by someone else than questions posted by myself. I try to read
the RFCs but they get pretty mind numbing sometimes(often).
Thanks again
-Al-



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

Date: Fri, 27 Oct 2000 09:26:47 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Linked lists
Message-Id: <slrn8vj0kn.jig.tadmc@magna.metronet.com>

On Fri, 27 Oct 2000 06:38:49 GMT, Mark-Jason Dominus <mjd@plover.com> wrote:
>
>
>I once said that linked list structures are never useful in Perl, and
>that the things they are useful for in other languages are almost
>always better-served by arrays.
>
>However, last week I found an exception.
     

s/found/caught/;

??


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


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

Date: Fri, 27 Oct 2000 15:36:40 +0100
From: "gina" <Gina.Joue@ucd.ie>
Subject: looking for speech recognition evaluator in perl
Message-Id: <newscache$x9f33g$bzk$1@weblab.ucd.ie>

Hi,

I'm looking for a perl program that will compare two strings and indicate
what parts of one of the string were deleted, substituted (and by what), or
inserted. It has to be an algorithm that would say that
t r o n
o a l e o n

in comparing /o l e o n/ with /t r o n/,
o is inserted (not a substitution for /t/)
a is inserted (not a substitution for /r/)
l is a substitution for /r/ (cos it is very similar to /r/)
etc....

Any help or suggestions is appreciated!!

G




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

Date: 27 Oct 2000 18:35:20 +0100
From: nobull@mail.com
Subject: Re: looking for speech recognition evaluator in perl
Message-Id: <u9wveu427b.fsf@wcl-l.bham.ac.uk>

"gina" <Gina.Joue@ucd.ie> writes:

[fuzzy matching]

> It has to be an algorithm

This is the crux.  You are realy asking about an alogithm.  The
implementation language is incidental.

I suspect this may be one of those so called "hard" problems in
computer science.

> Any help or suggestions is appreciated!!

You should probably try an AI newsgroup, or perhaps find an AI guru
near to you.  People who work in fields like speech recognition are
often quite knowlegible about fuzzy atching algoriths.

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


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

Date: Fri, 27 Oct 2000 09:11:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Matching and removing multiline block in perl 1-liner
Message-Id: <slrn8vivnr.jig.tadmc@magna.metronet.com>

On Fri, 27 Oct 2000 11:59:51 +0200, Jan Krag <jak@framfab.dk> wrote:

>I am trying to remove the following block of code:
>
>  <!-- PRINT_BLOCK - STATIC -->
>   <tr align="right" valign="top">
>    <td colspan="2"><a
>href="javascript:popUp('printUrl','pagePrint',584,500,'scrollbars');"
>class="dark"><img src="/opencms/content/internal/img/bn/bn_ic_print.gif"
>width="17" height="14" border="0" alt="Print" />Print</a></td>
>   </tr>
>  <!-- PRINT_BLOCK - STATIC -->


That looks like more than one line...

>I have attempted to use the following 1-liner in various (quite many)
>modifications:
>
>perl -i -pe 's/<!-- PRINT_BLOCK - STATIC -->.*<!-- PRINT_BLOCK -
         ^^
         ^^

 ... and that reads a single line at a time.


>but it doesn't seem to want to match.


Because the start and end delimiters are not on the same line.

You cannot match a multi-line pattern against a single-line string.

You either need to slurp in the whole file into a single scalar
(and use the s///gs options), or process it line-by-line (using
the magical range operator (perlop.pod) as suggested in another 
followup).


>And while I am asking; Is there a smart commandline switch (that I have
>missed) that will make it work recursively in subdirectories?


No, but there is the File::Find module that does recursive dir searches.


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


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

Date: 27 Oct 2000 17:48:29 +0100
From: nobull@mail.com
Subject: Re: Matching and removing multiline block in perl 1-liner
Message-Id: <u93dhi5ixu.fsf@wcl-l.bham.ac.uk>

"Jan Krag" <jak@framfab.dk> writes:

> I am having some problems making a small regexp work.
> I am trying to remove the following block of code:

> perl -i -pe 's/<!-- PRINT_BLOCK - STATIC -->.*<!-- PRINT_BLOCK -
> STATIC -->//gs;' index.html

perl -pe will apply the given perl code to modify each line of the
file in turn.  You want to apply the statements to the whole file
treated as a single string.  You have to tell Perl that there's no
such thing as an input line separator.

BEGIN{undef $/};

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


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

Date: Fri, 27 Oct 2000 16:57:27 GMT
From: philip_nicholas@my-deja.com
Subject: NT displaying and not not running .pl scripts
Message-Id: <8tcc5j$t7a$1@nnrp1.deja.com>

We have installed Active Perl on a client's machine running NT4 and
scripts run at the command prompt.

However, when we try to access scripts via the Internet we get the text
of the script in Internet Explorer, and a download process starts in
Netscape. In other words, our webserver seems not recognize that .pl
scripts should be run (see a very basic script at
http://melbourne.butterworths.co.uk/cgi-bin/test.pl)

I would be grateful for any help with this problem

Philip Nicholas


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 27 Oct 2000 17:22:01 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: NT displaying and not not running .pl scripts
Message-Id: <8tcdjh$ufh$1@nnrp1.deja.com>

In article <8tcc5j$t7a$1@nnrp1.deja.com>,
  philip_nicholas@my-deja.com wrote:
> We have installed Active Perl on a client's machine running NT4 and
> scripts run at the command prompt.
>
> However, when we try to access scripts via the Internet we get the
> text of the script in Internet Explorer, and a download process
> starts in Netscape. In other words, our webserver seems not recognize
> that .pl scripts should be run .

Which web server are you running? Have you looked at ActivePerl-
Winfaq6, ActivePerl Web Server Configuration and Troubleshooting?

 --
Regards,
Dick


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 27 Oct 2000 16:12:41 GMT
From: mailloop@localhost.com (P&C)
Subject: ODBC - Newbie having connection/setup problem
Message-Id: <39f9a5e0.104630330@netnews.voicenet.com>

I have installed an odbc connection under the System tab. No userid
nor password has been set.

I have installed the odbc.pm packages as instructed for use with the
ActiveState versions of Perl for Win32. I login as Administrator,
switch to the appropriate directory and run the test.pl script that
came with the odbc package and specify my dsn.  The test works
fine and reports no errors.

Next, I have a file called odbc_lib.pl which contains some high level
calls, this .pl file gets included in my normal perl scripts.  The
primary functions called are:
&initialize($dsn);
&execute_sql($statement);
&finish_odbc($dsn);

The initialize call does the following:
sub initialize {
    $DSN=$_[0];
    $dB = new Win32::ODBC($DSN) || die "Cannot open datasource: ($DSN)
";
    if ($dB eq "undef")
   {
        win32::ODBC::DumpError();
    }
}

Again, I have several other odbc connections defined
this same way using this same code but with different DSN's which are
working fine.

Now the problem, if I go to my URL and type in the test.pl which came
with the ODBC package

----------------------  T E S T   Error Report: ---------------------
	Error Report:
The following were errors:
Test 3a = new(): [-1024] [] "[Microsoft][ODBC Microsoft Access Driver]
Could not use '(unknown)'; file already in use."

Also, any attempts to call my &initialize($dsn); function just returns
a blank html page.  I never get the die message nor any other messages
and the database never gets updated.

What do I do next, where do I go from here?

Thanks,

Phil
p c   a t   n t a d m i n   d o t   c o m


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

Date: Fri, 27 Oct 2000 09:28:38 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Open URL as file
Message-Id: <slrn8vj0o6.jig.tadmc@magna.metronet.com>

On Fri, 27 Oct 2000 14:33:07 +1000, Kim Saunders <kims@emmerce.com.au> wrote:

>> open SESAME, "http://www.somedomain.com/this.gif";

>That would be very cool if you could do that natively in perl, open any
>http or ftp url as a file, without having to with LWP or whatever the ftp
>module is called (Net::FTP I spose).


That is being discussed as a possiblity for Perl 6.


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


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

Date: Fri, 27 Oct 2000 15:20:30 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: operators
Message-Id: <39F9811E.3A165C75@fujitsu-siemens.com>

Sundar wrote:
> =

> Could someone explain the following operators in the code below:
> 1. =3D~ (search, I think. Sort of like grep?)

Be default, pattern matching operators (like match, substiture, et al)
apply to $_. The =3D~ applies them to the variable on the leftm side.

> 2. s/^\d*\)\s*// (No idea!)

Substitue zero or more digits (\d*) followed by a right parenthesis (\))
followed by zero or more while space characters (\s*) at the start of
the string (^) by nothing (i.e. delete them).

> 3. /^\d+/ (No idea!)

matches  one or more digits at the beginning of the string (in $key, due
to the =3D~, see 1.)

> I'm not a Perl guy, so any help will be appreciated.

Nor am I, but perhaps "in the land of the blind, he who can see with one
eye is a king".

> HTML code:
> Name: <input type=3Dtext name=3D"01)required-name" size=3D20><p>
> Email: <input type=3Dtext name=3D"02)required-user_email" size=3D20><p>=

> Political affiliation: <p>
> <input type=3Dradio name=3D"03)political" value=3D"Democrat"> Democrat<=
br>
> <input type=3Dradio name=3D"03)political" value=3D"Republican"> Republi=
can<br>
> <input type=3Dradio name=3D"03)political" value=3D"Green"> Green<br>
> <input type=3Dradio name=3D"03)political" value=3D"Reform"> Reform<br>
> <input type=3Dradio name=3D"03)political" value=3D"Other"> Other
> <input type=3Dtext name=3D"04)otherpolitical" size=3D10>
> =

> PERL code:
> foreach $key (sort(keys(%input))) {
>   if ($key =3D~ /user_email/) {
>     $user_email =3D "$input{$key}";
>     $user_email =3D~ s/^\d*\)\s*//;
>     $user_email =3D~ s/required-//;
>   }
>   unless ($key =3D~ /^\d+/) {
>     next;
>   }
>   push (@sortedkeys, "$key|$input{$key}");
> }
> =

> What I would like to do is to check if 04)otherpolitical is blank
> conditional on the user selecting 03)political=3D"Other".

I'm not sure if this code does what it's supposed to do:
It scans the CGI input and, for every field name, it checks whether it
contains "user_email" (which is true only for "02)required-user_email")
and removes any "02)required-" or such from the beginning of THE VALUE
of that field, although the user probably won't enter an email address
of
"123) required-name@host"!
It then skips keys that don't have a digit up front (one could leave out
the + there, because if the key has one digit ($key =3D~ /^\d/), it's
bound to have one or more.
Then all name/value pairs are added to the sortedkeys array.

Hope I'm right and this helps,
($key =3D~ /^\d+/)) =

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)


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

Date: Fri, 27 Oct 2000 11:16:18 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Perl on NT
Message-Id: <39F9AA52.B2B72C63@mail.uca.edu>

Clay Irving wrote:
> 
> 
> Can you imagine Visual Perl++ Studio?

Maybe not so funny. See:
http://www.activestate.com/Products/VisualPerl.html

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Fri, 27 Oct 2000 15:01:00 GMT
From: alphazerozero@my-deja.com
Subject: Re: Removing line breaks from a string - HELP!
Message-Id: <8tc5b6$mql$1@nnrp1.deja.com>

In article <39F1CCB2.C63A2EDA@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:

> Your inherent ignorance beguiles your own malice intent
> and significant degree of illiteracy, consistently.

Being illiterate I am, no doubt, incorrect when I say that that ain't
grammatical. (to use an 19th century expression)

> Mine is not a solution but rather a demonstration,
> using this author's previous statements and givens,
> to clearly show, you as the original author, are nothing

If you're on about literacy then perhaps you don't mind me pointing out
that nor is this.  I believe you meant

 ... to clearly show _that_ you, the original author, are nothing

> more than an ignorant illiterate troll using myriad
> fake names with psychotic malice intent.

I am fairly certain that should be

 ... using _a_ myriad _of_ fake ....

> * sprinkles a few more seeds *

They appear to be sprouting quite nicely.

> Godzilla!

All in good fun eh?

:-)

alphazerozero


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 27 Oct 2000 15:09:06 GMT
From: alphazerozero@my-deja.com
Subject: Re: Removing line breaks from a string - HELP!
Message-Id: <8tc5qb$n8h$1@nnrp1.deja.com>

In article <39fafbc9.95366047@news.ispchannel.com>,
  nospamapgraham@ispchannel.com--- (Al) wrote:

> >Your inherent ignorance beguiles your own malice intent
>
> inherent-adj.Existing as an essential constituent or characteristic;
> intrinsic.
> **Ignorance can be a quality inherent in something, but it can't be
> said to be inherent in and of itself.

Hmm, to be fair surely she was implying that the subject of her vitriol
is inherently ignorant

> be·guile-v. tr.
>         3.To distract the attention of; divert: “to beguile you from
> the grief of a loss so overwhelming”
<SNIP>
> **I don't understand your use of this word at all.

Section 3 covers it I believe

> **"Malice" is a noun. I believe you ment "malicious intent."

In law the term "with malice intent" is used quite often I believe.
-->mal·ice (mls)
n.

1. A desire to harm others or to see others suffer; extreme ill will or
spite.
2. Law. The intent, without just cause or reason, to commit a wrongful
act that will result in harm to another.

------------------------------------------------------------------------
--------
[Middle English from Old French from Latin malitia, from malus, bad;
see mel-3 in Indo-European Roots.]



alphazerozero


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 27 Oct 2000 15:16:59 GMT
From: alphazerozero@my-deja.com
Subject: Re: Removing line breaks from a string - HELP!
Message-Id: <8tc692$nhb$1@nnrp1.deja.com>

In article <39F1D158.8C041CF5@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:

>   Line 1<br>  <br>  Line 2<br>

Indeed this correct.  But why point it out without a solution?

How about:

#!perl -w

while (<DATA>) {
	if (/.+\n/) {
		  s/\n/<br>/;
		  print;
	}
}

__DATA__
Line 1

Line 2

--------------------------------------------------------
Produces:
Line 1<br>Line 2<br>

alphazerozero


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 27 Oct 2000 15:30:51 GMT
From: alphazerozero@my-deja.com
Subject: Re: Removing line breaks from a string - HELP!
Message-Id: <8tc73b$oei$1@nnrp1.deja.com>

In article <sv3m8bf6ksq9fc@corp.supernews.com>,
  "Randy Harris" <harrisr@bignet.net> wrote:
>
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
> news:39F1D158.8C041CF5@stomp.stomp.tokyo...

> Either you invented your PRINTED RESULTS or you didn't run the code
> posted by Clay.  Not malice, just fact.


Actually I just got stung by the same problem.
I bet she ran it with that margin.  That would mean that the line in
the middle is not blank (it has a space or two in it) and therefore
produced the middle <BR>
Which brings up an interesting point.  What should the routine do if it
encounters spaces tabs etc on a supposedly blank line?  Turn it into a
<br> or not?

And perhaps you should look for honest reasons for someones actions
before you accuse them of what could be considered to be a fairly
serious offence?

alphazerozero



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 27 Oct 2000 10:51:16 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Removing line breaks from a string - HELP!
Message-Id: <39F9C094.7ADF42AE@stomp.stomp.tokyo>

alphazerozero@my-deja.com wrote:

> Godzilla! wrote:
 
> > Your inherent ignorance beguiles your own malice intent
> > and significant degree of illiteracy, consistently.
 
> Being illiterate I am, no doubt, incorrect when I say that that ain't
> grammatical. (to use an 19th century expression)
 

> > more than an ignorant illiterate troll using myriad
> > fake names with psychotic malice intent.
 
> I am fairly certain that should be
 
> ... using _a_ myriad _of_ fake ....
 


Amusing how you insist on displaying both your ignorance
and illiteracy in myriad ways. Never use " a " and " of "
with myriad, both are implied by definition of myriad.
I wouldn't be surprised to discover you are one of those
who uses " off of " in speech.

Godzilla!


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

Date: Fri, 27 Oct 2000 13:35:35 -0400
From: "Eric" <eric.kort@vai.org>
Subject: Resolved: How can I word wrap on STDOUT?
Message-Id: <8tce8i$2g3f$1@msunews.cl.msu.edu>

"Eric" <eric.kort@vai.org> wrote in message
news:8t99qd$1ea8$1@msunews.cl.msu.edu...
> I have a Perl program that reads a BibTex bibliography and returns the
> abstracts and reference keys matching search criteria I specify at the
> prompt.  However, when it prints the abstract(s) to the screen, I wish it
> would word wrap rather than just wrap at the terminal boundary (makes it a
> little distracting to read).

Wow...I am overwhelmed by all the responses from so very many helpful and
insightful people (now if only there was so much discussion over my PerlXS
questions =] ).

Thanks for the responses...I think I will try the format approach, because
that is not a portion of Perl that I have learned to use yet, and then I
will simultaneously achieve my immediate goal of word wrapping and my long
term goal of being a better Perl programmer.

Eric




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

Date: Fri, 27 Oct 2000 15:37:39 GMT
From: "Elaine Ashton" <elaine@chaos.wustl.edu>
Subject: Re: stat / inode question
Message-Id: <7jhK5.12797$AM5.241071@news1.nokia.com>

"Christelle Gibergues" <christelle.gilbergues@eed.ericsson.se> wrote in
message news:39F954E8.BBCC7CBC@eed.ericsson.se...
> I am currently fighting with some silly software where hard-links are
> used.

Clearcase? I've called it a lot worse than silly....

> I'm real confused by this, and don't know which I should trust, stat or
> ls -i.

Unless you built the Perl on that machine yourself, I'd trust ls -i first
and foremost.

> Any ideas why it is different, and if it matters much?

It shouldn't be and yes it matters much. I would guess that something
about your perl compiler is not right. For grins, download a fresh copy,
build it and install it in your home dir or some temp space and try again.
Also, you might post the program you are using which could also be wrong
and misleading you.

e.





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

Date: 27 Oct 2000 17:44:45 +0100
From: nobull@mail.com
Subject: Re: stat / inode question
Message-Id: <u97l6u5j42.fsf@wcl-l.bham.ac.uk>

> My problem is that the output of stat($file)[1] seems to be
> different from that of a 'ls -i $file'. 

> I'm real confused by this, and don't know which I should trust, stat or
> ls -i.

I'd get a third oppinion.  Write a trivial program on C to print out
the inode field from stat(), or if you have GNU-find you could use the -printf
"%i" option.

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


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

Date: Fri, 27 Oct 2000 16:39:33 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: what does /warn "$x" if "$x"/ mean
Message-Id: <svjbu5c81qgl89@corp.supernews.com>

joechakra@my-deja.com wrote:
: My question what is the meaning of
:     warn "$x" if "$x";

The double-quotes are unnecessary.  This means "Stringify $x;  if the
result evaluates as true, send the value of $x as a warning, typically to
STDERR. 

:     $count=0+$x;

$count gets the number-ified value of $x.  For example, if $x were '007',
$count would get the value 7.  Adding 0 is the standard idiom for forcing
a value to be a number.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Fri, 27 Oct 2000 09:14:56 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: What's wrong with this regex?
Message-Id: <slrn8vivug.jig.tadmc@magna.metronet.com>

On Fri, 27 Oct 2000 04:02:29 GMT, Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "DS" == David Sisk <davesisk@ipass.net> writes:

>  DS> (\d*) (\d*)\/(\d*)/);

>also don't escape \ in a regex, use a different delim.
                   ^
                   ^

Uri meant "/" there   (I know 'cause I asked the PSI::ESP module).


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


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

Date: 27 Oct 2000 10:01:40 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: What's wrong with this regex?
Message-Id: <m3bsw6tjjf.fsf@dhcp11-177.support.tivoli.com>

Dominique Lorre <dlorre@caramail.com> writes:

> You might want to try something like this:

> #!/usr/bin/perl -w
> use strict;
> 
> my($some_variable, $other_variable, @examples) ;
> 
> @examples = (
> 	"00 Nov 5 (IFQ KA-E)",
> 	"00 Nov 7 1/2 (IFQ KB-E)",
> 	"00 Nov 10 (IFQ KC-E)",
>         "00 Nov 12 1/2 (IFQ KD-E)"
> ) ;
> 
> 
> foreach $other_variable(@examples) {
> $some_variable = -1 ; # undef marker
> $some_variable = $3?$1+$2/$3:$1
> if ($other_variable =~ |\d{2} [A-Za-z]{3} (\d*) (\d*)/*(\d*)|);
                        ^
                        m

> print "$some_variable = $some_variable\n" ;
> }

-- 
Ren Maddox
ren@tivoli.com


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

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 V9 Issue 4744
**************************************


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