[30910] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2155 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 25 00:09:47 2009

Date: Sat, 24 Jan 2009 21:09:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 24 Jan 2009     Volume: 11 Number: 2155

Today's topics:
    Re: inputting the ephemerides <larry@example.invalid>
    Re: inputting the ephemerides <larry@example.invalid>
    Re: inputting the ephemerides sln@netherlands.com
    Re: inputting the ephemerides <tadmc@seesig.invalid>
    Re: inputting the ephemerides <tadmc@seesig.invalid>
    Re: inputting the ephemerides <tadmc@seesig.invalid>
    Re: inputting the ephemerides <uri@stemsystems.com>
    Re: OCaml, Language syntax, and Proof Systems <xahlee@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 24 Jan 2009 17:25:12 -0700
From: Larry Gates <larry@example.invalid>
Subject: Re: inputting the ephemerides
Message-Id: <5lgyfqsolasq$.1ap5rnjvb326d$.dlg@40tude.net>

On Sat, 24 Jan 2009 15:51:07 +0200, Eric Pozharski wrote:

> On 2009-01-23, Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
>> On 2009-01-22 23:19, Eric Pozharski <whynot@pozharski.name> wrote:
> *SKIP*
>>> I assume that LG didn't copy-paste.  What a surprise...
>>
>> He did copy-paste (as you would have seen yourself if you had read the rest
>> of my (or his) posting). He just just copy-pasted one character too
>> little (or too much), splitting a sub-pattern in half. Which could
>> either be just a copy-paste error (indicating sloppy editing) or a
>> failure to understand how regular expressions are constructed.
> 
> My fault.

I thought that the decimal point was how the fields in the regex broke up,
so when I had /.*/, I thought the asterisk was the first character.

I've learned a lot of perl in a couple weeks here.  With regexes, there so
much to know that you can hardly gauge how much you don't know of it.  I've
read for at least an hour a day in the camel book and spent several hours a
day on my machine, and all I can do is just a little bit more than I could
the last time I hit it.

I hope one day to have a Helen Keller water moment with the whole thing.

Cheers,
-- 
larry gates

And other operators aren't so special syntactically, but weird
in other ways, like "scalar", and "goto".
             -- Larry Wall in <199711071749.JAA29751@wall.org>


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

Date: Sat, 24 Jan 2009 17:37:26 -0700
From: Larry Gates <larry@example.invalid>
Subject: Re: inputting the ephemerides
Message-Id: <vxt888htljiu.so0hoyxtchkb$.dlg@40tude.net>

On Sat, 24 Jan 2009 08:08:14 -0800, Tim Greer wrote:

> Peter J. Holzer wrote:
> 
>> On 2009-01-24 06:40, Tim Greer <tim@burlyhost.com> wrote:
>>> Larry Gates wrote:
>>>
>>>> Wouldn't a split work well here?
>>>
>>> Split works well when you don't have white space in the fields
>>> themselves,
>> 
>> You can split on other strings than whitespace.
> 
> Yes, I know, but the OP wants to split on whitespace in this case. :-)

This is what I've got now:

   my $filename = 'eph6.txt';
   my $filename2 = 'outfile1.txt';
   open(my $fh, '<', $filename) or die "cannot open $filename: $!";
   open(my $gh, $filename2) or die "cannot open $filename2: $!";

   while (my $line = <$fh>) {
   $line =~ s/\t/   /g;
   $line =~ s/ER/ /g;
   $line =~ s/°/ /g;
   print $gh $line;
   print STDOUT $line;
   }
   close($fh);

  seek($gh,0,0);

   while (my $line = <$gh>) {

  my @s = split / /, $line;

#   print $gh $line;
   print STDOUT  @s;
   }

   close($gh);

# perl reg2.pl

I've got 2 questions:

q1) How do I loop over @s and print them out with a delimiter to see if I
have what I think I have?  One response is, "how many times do we have to
tell you this?"  I think the answer is at least 3; I can't figure it out
and have tried serially.

q2)  How do I write to $gh and replace thw entire file, even if there are
fewer characters in the replacer?


-- 
larry gates

The choice of approaches could be made the responsibility of the
programmer.
             -- Larry Wall in <199709081901.MAA20863@wall.org>


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

Date: Sun, 25 Jan 2009 01:25:36 GMT
From: sln@netherlands.com
Subject: Re: inputting the ephemerides
Message-Id: <iffnn497l4a6hkbjv2lbqbu1eegh34v7bc@4ax.com>

On Sat, 24 Jan 2009 17:25:12 -0700, Larry Gates <larry@example.invalid> wrote:

>On Sat, 24 Jan 2009 15:51:07 +0200, Eric Pozharski wrote:
>
>> On 2009-01-23, Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
>>> On 2009-01-22 23:19, Eric Pozharski <whynot@pozharski.name> wrote:
>> *SKIP*
>>>> I assume that LG didn't copy-paste.  What a surprise...
>>>
>>> He did copy-paste (as you would have seen yourself if you had read the rest
>>> of my (or his) posting). He just just copy-pasted one character too
>>> little (or too much), splitting a sub-pattern in half. Which could
>>> either be just a copy-paste error (indicating sloppy editing) or a
>>> failure to understand how regular expressions are constructed.
>> 
>> My fault.
>
>I thought that the decimal point was how the fields in the regex broke up,
>so when I had /.*/, I thought the asterisk was the first character.
>
>I've learned a lot of perl in a couple weeks here.  With regexes, there so
>much to know that you can hardly gauge how much you don't know of it.  I've
>read for at least an hour a day in the camel book and spent several hours a
>day on my machine, and all I can do is just a little bit more than I could
>the last time I hit it.
>
>I hope one day to have a Helen Keller water moment with the whole thing.
>
>Cheers,

Unfortunately, you have wasted alot of peoples time at your expense.
Why don't you take Perl education classes, or just learn from books where
its all there in front of your eyes. Do your eyes deceive you?

Unique questions are ok, and will get you over the hurdle where your stuck,
but you have a psychological problem, the need to have your hand held online.

You are truly an attention troll.

sln



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

Date: Sat, 24 Jan 2009 21:34:17 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: inputting the ephemerides
Message-Id: <slrngnnndp.vt.tadmc@tadmc30.sbcglobal.net>

Larry Gates <larry@example.invalid> wrote:


>    open(my $gh, $filename2) or die "cannot open $filename2: $!";


Do you intend for the filehandle to be opened for input or for output?

(it is opened for input here.)


>    print $gh $line;


You are attempting to use it for output here.



    You should always enable warnings when developing Perl code!


    #!/usr/bin/perl
    use warnings;
    use strict;


>    while (my $line = <$gh>) {


 ... and now for input.


>   my @s = split / /, $line;


> I've got 2 questions:
>
> q1) How do I loop over @s and print them out with a delimiter to see if I
> have what I think I have?  One response is, "how many times do we have to
> tell you this?"  I think the answer is at least 3; I can't figure it out
> and have tried serially.


    print "'$_'\n" for @s;

don't even need @s:

    print "'$_'\n" for split / /, $line;


    print "'$_'\n" for @s;

don't even need @s:

    print "'$_'\n" for split / /, $line;


    print "'$_'\n" for @s;

don't even need @s:

    print "'$_'\n" for split / /, $line;



> q2)  How do I write to $gh 


A first step would be to get it opened for output...


> and replace thw entire file, even if there are
> fewer characters in the replacer?

   perldoc -f truncate


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Sat, 24 Jan 2009 21:19:46 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: inputting the ephemerides
Message-Id: <slrngnnmii.vt.tadmc@tadmc30.sbcglobal.net>

Larry Gates <larry@example.invalid> wrote:

> With regexes, there so
> much to know that you can hardly gauge how much you don't know of it.  I've
> read for at least an hour a day in the camel book and spent several hours a
> day on my machine, and all I can do is just a little bit more than I could
> the last time I hit it.


If you are willing to trade money for (saved) time, buy:

   "Mastering Regular Expressions"

   http://regex.info


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Sat, 24 Jan 2009 21:22:33 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: inputting the ephemerides
Message-Id: <slrngnnmnp.vt.tadmc@tadmc30.sbcglobal.net>

sln@netherlands.com <sln@netherlands.com> wrote:

> you have a psychological problem


That's rich, considering the source.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Sat, 24 Jan 2009 23:17:38 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: inputting the ephemerides
Message-Id: <x78wp0uihp.fsf@mail.sysarch.com>

>>>>> "LG" == Larry Gates <larry@example.invalid> writes:

  LG>    while (my $line = <$fh>) {
  LG>    $line =~ s/\t/   /g;
  LG>    $line =~ s/ER/ /g;
  LG>    $line =~ s/°/ /g;
  LG>    print $gh $line;
  LG>    print STDOUT $line;
  LG>    }
  LG>    close($fh);

  LG>   seek($gh,0,0);

  LG>    while (my $line = <$gh>) {

this is insane. why are you fixing up the input, writing it to a file
and then reading in the file again??? just read in the original file and
fix up the data and split it. you are using fortran and batch logic here.

i didn't follow this thread closely but seeing you want to learn seek()
piqued my interest.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Sat, 24 Jan 2009 20:31:14 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: Re: OCaml, Language syntax, and Proof Systems
Message-Id: <1c66ef53-22a3-46b5-8fb5-3cde3deafaf3@p23g2000prp.googlegroups.com>

Language, Purity, Cult, and Deception

Xah Lee, 2009-01-24

[this essay is roughly a 10 years personal retrospect of some
languages, in particular Scheme and Haskell.]

I learned far more Ocaml in the past 2 days than the fucking 2 months
i tried to learn Haskell, with 10 years of =E2=80=9CI WANT TO BELIEVE=E2=80=
=9D in
haskell.

The Haskell's problem is similar to Scheme lisp, being academic and of
little industrial involvement. About 10 years ago, during the dot com
era around 1999, where scripting war is going on (Perl, tcl,
Applescript, Userland Frontier, with in the corner Python, Ruby, Icon,
Scheme, in the air of Java, HTML 3, CSS, CGI, javascript), i was sold
a lie by Scheme lisp. Scheme, has a aura of elegance and minimalism
that's one hundred miles in radius. I have always been a advocate of
functional programing, with a heart for formal methods. Scheme, being
a academic lang, has such a association. At the time, Open Source and
Linux have just arrived on the scene and screaming the rounds in the
industry, along with Apache & Perl. The Larry Wall scumbag and Eric
Raymond motherfucker and Linus T moron and Richard Stallman often
appears in interviews in mainstream media. Richard Stallman's FSF with
its GNU, is quick to make sure he's not forgotten, by a campaign on
naming of Linux to GNU/Linux. FSF announced that Scheme is its chosen
scripting lang for GNU system. Plans and visions of Guile =E2=80=94 the new
Scheme implementation, is that due to Scheme Lisp's power will have
lang conversion abilities on the fly so programers can code in other
lang if they wanted to, anywhere in the GNU platform. Around that
time, i also wholeheartedly subscribed to some A Brave Gnu World
bulletin of FSF with high expectations.

Now, it's 2009. Ten years have passed. Guile disappeared into
oblivion. Scheme is tail recursing in some unknown desert. PHP
practically and quietly surpassed the motherfucking foghorn'd Perl in
early 2000s to become the top 5 languages. Python has surfaced to
became a mainstream. Ruby is the hip kid on the block. Where is
Scheme? O, you can still hear these idiots debating tail recursions
among themselves in newsgroups. Tail recursion! Tail recursion! And
their standard the R6RS in 2007, by their own consensus, is one fucked
up shit.

In 2000, i was a fair expert in unix technologies. Sys admin to
several data center's solaris boxes each costing some 20 grands.
Master of Mathematica and Perl but don't know much about any other
lang or lang in general. Today, i am a expert of about 5 languages and
working knowledge with tens or so various ones. There is nothing in
Scheme i'd consider elegant, not remotely, even if we only consider
R4RS.

Scheme, like other langs with a cult, sold me lie that lasted 10
years. Similarly, Haskell fucked me with a tag of =E2=80=9Cno assignment=E2=
=80=9D
purity. You can try to learn the lang for years and all you'll learn
is that there's something called currying and monad. I regret i
learned python too in 2006. Perl is known for its intentional
egregious lies, lead by the demagogue Larry Wall (disclaimer: opinion
only). It fell apart unable to sustain its =E2=80=9Cpost-modernistic=E2=80=
=9D
deceptions. Python always seemed reasonable to me, until you stepped
into it. You learned that the community is also culty, and is into
certain grand visions on beauty & elegance with its increasingly
complex syntax soup with backward incompatible python 3.0. The python
fuckheads sport the air of =E2=80=9Ccomputer science R us=E2=80=9D, in real=
ity they
are idiots about the same level of Perl mongers. (Schemers and Haskell
people at least know what they are talking about. They just don't have
the know how of the industry.)

I think my story can teach tech geekers something. In my experience,
the langs that are truely a joy to learn and use, are those sans a
cult. Mathematica, javascript, PHP, are all extremely a joy to use.
Anything you want to do or learn how to do, in so far that the lang is
suitable, can be done quickly. Their docs are to the point. And today
i have to include Ocaml. It's not about whether the lang is
functional, or whether the lang is elegant, or what theoretical power
it has. Also, lang of strong academic background such as Scheme and
Haskell are likely to stay forever there, regardless what is the
technical nature of the lang. The background of the community, makes
half what the language is.

Disclaimer: All mentions of real persons are opinion only.

  Xah
=E2=88=91 http://xahlee.org/

=E2=98=84


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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 2155
***************************************


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