[24450] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6633 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 31 14:06:11 2004

Date: Mon, 31 May 2004 11:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 31 May 2004     Volume: 10 Number: 6633

Today's topics:
    Re: Beginner needs help with script :) <gnari@simnet.is>
    Re: Beginner needs help with script :) <sbryce@scottbryce.com>
    Re: Beginner needs help with script :) <sbryce@scottbryce.com>
    Re: Beginner needs help with script :) <notachance@inhell.com>
    Re: Beginner needs help with script :) <notachance@inhell.com>
    Re: Beginner needs help with script :) <notachance@inhell.com>
    Re: Beginner needs help with script :) <notachance@inhell.com>
    Re: Beginner needs help with script :) <notachance@inhell.com>
    Re: Beginner needs help with script :) <notachance@inhell.com>
    Re: Beginner needs help with script :) <jurgenex@hotmail.com>
    Re: Beginner needs help with script :) <1usa@llenroc.ude>
    Re: Beginner needs help with script :) <uri@stemsystems.com>
    Re: Beginner needs help with script :) <gnari@simnet.is>
    Re: Beginner needs help with script :) <gnari@simnet.is>
    Re: Login to MS Exchange to send e-mail <ywwong_hk@hotmail.com>
        reading variable and fixed length records <nothingread@hotmail.com>
    Re: reading variable and fixed length records (Walter Roberson)
    Re: reading variable and fixed length records <nothingread@hotmail.com>
    Re: reading variable and fixed length records <noreply@gunnar.cc>
    Re: Removing HTML tags: is there a Perl-equivalent to P <wherrera@lynxview.com>
    Re: splitting cvs file and insert in mysql via DBI <javier@t-online.de>
    Re: splitting cvs file and insert in mysql via DBI <gnari@simnet.is>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 31 May 2004 14:59:38 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fh5j$o2m$1@news.simnet.is>

"Player" <notachance@inhell.com> wrote in message
news:c9f7eg$s2j$1@news7.svr.pol.co.uk...
>
> "gnari" <gnari@simnet.is> wrote in message
> news:c9f4v9$mqf$1@news.simnet.is...
> > "Player" <notachance@inhell.com> wrote in message
> > news:c9f4g2$e34$1@newsg2.svr.pol.co.uk...

[snip ctrl-Z failing on XP]

> > >
> > > Anyone no what I am doing wrong here?
> >
> > are you sure the CTRL-Z is the only character in the line?

> Yeah what it is asking is for the reader to to the ctrl+d or ctrl+z to
stop
> the stdin and go onto the next line.
> But when pressing ctrl+d or ctrl+z in the windows xp command console black
> window, it simply prints either of these two characters on the command
> console window, ^z  ^d
>
> So as yet I haven't a clue as to what I can do to make the script work.

works on windows2000:
==
C:\perlcode>perl test.pl
Enter students names (press <CTRL>+Z when done):
name1
anothername
onemoreforluck
^Z


Enter associated grades (press <CTRL>+Z when done):
1
2
3
^Z

C:\perlcode>
==

can you cutandpaste equivalent terminal output from your
end ? (not that we do not believe you did it correctly,
but you never know...)

gnari






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

Date: Mon, 31 May 2004 09:09:37 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <10bmilh17eocb1f@corp.supernews.com>

Player wrote:

> So what-ever- got up your nose, isn't worth the effort of those few lines
> you wrote, because it's only two news groups and both are there to help
> people with perl.
> So take your bullying tactics else were they are not appreciated here, thank
> you very much.

Being rude to some of the most knowledgeable and generous people in the 
Perl community is not a good way to get your questions answered.



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

Date: Mon, 31 May 2004 09:19:09 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <10bmj7dop8kv415@corp.supernews.com>

Player wrote:

> I don't like being bullied

You weren't being bullied. You were given good advice.


> and as I am new to news
> groups in general, I am hardly going to no every single detail of what-ever
> bunch of in-house-secret-guidelines people have made up over the years.

The guidelines are posted on this newsgroup.


> I don't take kindly to people telling me, "DON'T" one something I pay money
> to gain access to, especially when those people are not in any position of
> authority were my money heads to.

Then perhaps seeking help with your Perl scripts is not a good idea.


> The appropriate response in most cases to such a statement, would be, "I Beg
> your pardon? are some sort of authority figure here?"

Moreso than you are. As a newbie, perhaps it would be best to swallow 
your pride, take the advice you were given and read the posting 
guidelines that are posted here regularly.

And please don't try to make an issue out of who is and who isn't an 
authority here. Obviously, nobody owns this newsgroup. For you to dive 
in here, oblivious to posting conventions and start telling people off 
because you don't understand basic nettiquite is quite rude.



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

Date: Mon, 31 May 2004 16:28:33 +0100
From: "Player" <notachance@inhell.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fiv2$3pb$1@news8.svr.pol.co.uk>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrncbmgpr.fnl.tadmc@magna.augustmail.com...
> Player <notachance@inhell.com> wrote:
> >
> > "Alan J. Flavell" <flavell@ph.gla.ac.uk> wrote in message
> > news:Pine.LNX.4.53.0405311251320.30551@ppepc56.ph.gla.ac.uk...
>
> >> Seems to me that the subject line already told us as much as we needed
> >> to know about the questioner and its attitude to posting guidelines.
>
> > So basically Alan J  Flavell what your saying is that a beginner
shouldn't
> > come to these forums and post a question about perl AT ALL?
>
>
> That is an obsurd conclusion. How did you reach it?
>
> Alan did not say anything about posting Perl questions, he said
> something about the Subject header's contents.
>
> With logic like that, you should consider some field other than
programming.

Yes what he was saying was that the subject matter in my subject line, told
him that I was in some way not me btohered with or that I was in some way
wrong or something similar.
And I put it to him and you that my subject line simplysays I am a beginner
who needs help, and you cant get more honest and humble than that in front
of millions of people.
So I concluded that he must think I am not supposed to ask questions in this
forum, because that is what that subject line does.

>
>
> > Because the subject line of my original post, has absolutely nothing
wrong
> > with it.
>
>
> Says you.

Yes I do say so.
>
> But the Subject is not _for_ you, it is for the audience that you
> are trying to reach.

Yes and asking for help because you are a beginner, in front of millions of
other readers, is very honest and humble I think. Considering I was entering
what I thought to be the realms of people who were genuises and could code
and understand a language that I couldn't, I would say I was being
forthright and brutaly honest with myself and those I wanted to meet and ask
questions of.
BOY was I wrong.

>
> Everyone except you thinks that there is something wrong with it.

Well as I have said, I was being honest, you cant get MORE HUMAN than that.
Sorry my fault for being HUMAN i guess huh.
>
> (namely, we cannot tell what your article is about from the Subject)

Yes you can, it says that a beginner needs help with a script.
If you don't understand that and couldn't read that and understand it in a
way that would automaticaly lead you to think, "right well elts have a look
at the script then"
Then you need to go back to school period.

>
>
> > It line states that I am a beginner and that I need help with a
> > perl script,
>
>
> Your question is not about being a beginner.
>
> Your question is about how to mark the end-of-file in a Windows
> command interpreter (it is not even a question about Perl).

Of course it is, that command is used in perl and it is were I first
experienced it, so naturaly BEING HUMAN I came to a place were I thought I
could get help with PERL.
D'OH stupid me, boy was I wrong.

>
> If you were using Python or Java instead of Perl, you would mark
> the eof the same way, it does not depend on your choice of
> programming langauge.

How would I no this? hmmm?
I am a beginner.

>
>
> > just as no doubt thousands of other people have come into this
> > and other perl groups before looking for help.
>
>
> So then your message is just like the other 200 that are posted here
> each day. Your choice of Subject added no value whatsoever.

But the ones I showed as being similar to mine, got responses, none of them
got responses telling them to word their subject lines better, or in my case
more insulting words but meaning the same thing really, just made more
insulting to further belittle me.

>
> Nobody reads all 200. They must "filter" them somehow (by seeing
> what the Subject header says).

Probably so, I couldn't possibly say as I am new, but my point stands in
this sub point of many that have sprung up in this tirade of insults and
belittling being directed my way.
They didn't get told what I was told with regards to the subject title line.

>
> Your Subject does not help potential answerers determine whether they
> might be able to help with your subject, because they cannot tell
> what your subject is.

So being human isn't enough in here is that what your saying?
Let me put it this way, apart from not being human in my atempts to
communicate with people in here, I should try and be all smart and technical
in my subject lines, even though I don't no the slightest damn thing about
the language yet. hrmm is that what your telling me?

>
> So they will skip your article and go on to one who's author has
> taken the trouble to accurately describe what it is that they
> need help with.


'Taken the trouble' kinda forms the opinion that I in some way thought you
all complete slaves and idiots and that you would read my post no matter
what I put.
That is ludicrous, I was simply being human in a situation I was very
nervous about, as I don't and didn't want to fail in learning my 1st
computer language.

>
> Do you _want_ people to ignore your questions?

Obviously not, do not speak down to me like I am a child sir, because I am
far from that, and if nothing else I will not have you trying to play school
headmaster with me.

>
> Sure does seem like it...

Seem did a silly thing one day and never came back.
>
>
> > What got up your particular nose hmm?
>
>
> You did something socially unacceptable.

Well at the time I had no idea that it would be so.

>
> You must expect some angst when you choose to be socially unacceptable,
> that shouldn't be too hard to see, yet you cannot see it...

I can accept critism when I fully understand were the person is coming from
what I dont accept, is people trying to bully me, belittle me, and try to
humiliate me in front of thousand, just for laughs.

>
>
> > Is that I am a beginner?
>
>
> No, it is that you were being rude.

I was only being crass because i though the original reple was being so to
me, once I found out he wasn't, I understood.
However by then, half the population of the group thought it funny to join
in and try and humiliate and belittle me, not to mention dash any chances I
had of trying to get help.
Nice attitude to beginners you all have there, youa re to be commended on
your pure evilness.

>
> Polite beginners get help with their problems here every day.

That is not my experience so far.

>
>
> > Please explain to me in detail what the hell is wrong with a beginner
coming
> > to a perl news group seeking help with a script?
>
>
> Nothing, but that is not what happened in this thread, so I wonder
> why you bring it up.

I bring it up because of the multitude of other replies mixed in with yours,
that have been avalanshe dupon me in some insain atempt to try and get me to
back down abd be a good little obedient 'THING' and take the abuse like all
newcomers should.
Well not this guy, sorry.

>
>
> > Because I would really like to no.
>
>
> You are not fooling anyone with that.

Well then thats alright then, because I wasn't trying to fool anyone,
everything I have said has been up front and honest.

>
> On the contrary, you have displayed a remarkable _resistance_ to
> finding out what was seen as rude in your original post.

I have admited 3 times now that I was mistaken in my understanding of the
original repliers post.
I have said that I was mistaken in thinking that what the original replyer
said, was a bulolish attitude, and that me coming fresh faced into the news
group leadme to be unprepared for certain things that everyone else takes
for granted.





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

Date: Mon, 31 May 2004 16:30:00 +0100
From: "Player" <notachance@inhell.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fj1o$tgk$1@newsg1.svr.pol.co.uk>


"A. Sinan Unur" <1usa@llenroc.ude> wrote in message
news:Xns94FA6CFDCF944asu1cornelledu@132.236.56.8...
> "Player" <notachance@inhell.com> wrote in
> news:c9f6sv$v9g$1@newsg4.svr.pol.co.uk:
>
> > I don't take kindly to people telling me, "DON'T" one something I pay
> > money to gain access to
>
> Hmmm ... you are not paying anyone here.
>
> Don't be a troll.

No I pay my isp for the privilege of being able to access these groups.

Player




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

Date: Mon, 31 May 2004 16:36:48 +0100
From: "Player" <notachance@inhell.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fjeg$9qj$1@newsg4.svr.pol.co.uk>


"Scott Bryce" <sbryce@scottbryce.com> wrote in message
news:10bmj7dop8kv415@corp.supernews.com...
> Player wrote:
>
> > I don't like being bullied
>
> You weren't being bullied. You were given good advice.

At first, yes you're quite correct, But unfortunately I didn't see it at
that time, and thought the person was being crass and bullish. I said I have
realised that now.

HOWEVER what has happened since that first post, is nothing short of
systematic group attempt at trying to humiliate and belittle me in front of
thousand of other readers.
Probably just for the fun of it to no doubt, or maybe because it's the
'DONE' round here I don't no.
But either way, I wont stand for it, period.

Player




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

Date: Mon, 31 May 2004 16:43:29 +0100
From: "Player" <notachance@inhell.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fjr1$pts$1@newsg2.svr.pol.co.uk>

> can you cutandpaste equivalent terminal output from your
> end ? (not that we do not believe you did it correctly,
> but you never know...)
>
> gnari
>
>
>
>



Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings>cd ..

C:\>cd Scripts

C:\Scripts>dir
 Volume in drive C has no label.
 Volume Serial Number is 7494-1D4D

 Directory of C:\Scripts

31/05/2004  11:14    <DIR>          .
31/05/2004  11:14    <DIR>          ..
31/05/2004  12:15               429 gradehash.pl
31/05/2004  11:33               149 names.pl
               2 File(s)            578 bytes
               2 Dir(s)   8,400,154,624 bytes free

C:\Scripts>perl gradehash.pl
Enter students names (press <CTRL>+Z when done): sam tom bobZ
Z
Z


I tried three times to dfo it that time, and all it did was print the Z you
see there.

The code for the script is below here....

%grades=();

print "Enter students names (press <CTRL>+Z when done): ";
@names = <STDIN>;
chomp @names;
print "\n\n";
print "Enter associated grades (press <CTRL>+Z when done): ";
@scores = <STDIN>;

@grades{@names} = @scores




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

Date: Mon, 31 May 2004 16:44:58 +0100
From: "Player" <notachance@inhell.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fjtq$4gd$1@news8.svr.pol.co.uk>

The reply comes back

^Z

then I press enter/return and it simply goes onto the nest line and waits.

Player




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

Date: Mon, 31 May 2004 16:58:09 +0100
From: "Player" <notachance@inhell.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fkmi$qjr$1@newsg2.svr.pol.co.uk>

I think I figured the thing out anyways.

I have to press enter or return after every entry for the grades and names
lists and then do a CTRL+Z and then press enter/return again.

If I just run the script and enter the names one after the other just using
space bar to seperate them instead of using enter/return, then it doesnt
work.

Player




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

Date: Mon, 31 May 2004 16:09:20 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <QMIuc.14993$oh7.11262@nwrddc01.gnilink.net>

Player wrote:
> "A. Sinan Unur" <1usa@llenroc.ude> wrote in message
> news:Xns94FA6CFDCF944asu1cornelledu@132.236.56.8...
>> "Player" <notachance@inhell.com> wrote in
>> news:c9f6sv$v9g$1@newsg4.svr.pol.co.uk:
>>
>>> I don't take kindly to people telling me, "DON'T" one something I
>>> pay money to gain access to
>>
>> Hmmm ... you are not paying anyone here.
>>
>> Don't be a troll.
>
> No I pay my isp for the privilege of being able to access these
> groups.

So what? So does the fast majority of Usenet users.
Do you really believe this gives you any right to (mis-)behave like you
please?

Luckily there is no need to read you.
Welcome to the kill file.

jue




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

Date: 31 May 2004 16:19:13 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Beginner needs help with script :)
Message-Id: <Xns94FA7D547C466asu1cornelledu@132.236.56.8>

"Player" <notachance@inhell.com> wrote in news:c9fj1o$tgk$1
@newsg1.svr.pol.co.uk:

> 
> "A. Sinan Unur" <1usa@llenroc.ude> wrote in message
> news:Xns94FA6CFDCF944asu1cornelledu@132.236.56.8...
>> "Player" <notachance@inhell.com> wrote in
>> news:c9f6sv$v9g$1@newsg4.svr.pol.co.uk:
>>
>> > I don't take kindly to people telling me, "DON'T" one something 
>> > I pay money to gain access to
>>
>> Hmmm ... you are not paying anyone here.
>>
>> Don't be a troll.
> 
> No I pay my isp for the privilege of being able to access these groups.

Too bad, 'cause your ISP ain't gonna answer your Perl questions. It seems 
unlikely that many people here will either.

Paying your ISP does not give you the right to be rude to other people or 
ignore conventions.

While no one can deny you the right to post here, you cannot compel 
anyone to help you. People will only help you if you respect the free 
help they provide you. Whether you would like to get help or just hear 
the echos of your own posts as they fall to the bottom of the bit bucket 
is up to you.

Don't be rude.

-- 
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)


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

Date: Mon, 31 May 2004 16:32:16 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Beginner needs help with script :)
Message-Id: <x7zn7o7e27.fsf@mail.sysarch.com>

>>>>> "P" == Player  <notachance@inhell.com> writes:

  P> "A. Sinan Unur" <1usa@llenroc.ude> wrote in message
  P> news:Xns94FA6CFDCF944asu1cornelledu@132.236.56.8...
  >> "Player" <notachance@inhell.com> wrote in
  >> news:c9f6sv$v9g$1@newsg4.svr.pol.co.uk:
  >> 
  >> > I don't take kindly to people telling me, "DON'T" one something I
  >> pay > money to gain access to
  >> 
  >> Hmmm ... you are not paying anyone here.
  >> 
  >> Don't be a troll.

  P> No I pay my isp for the privilege of being able to access these
  P> groups.

and how do they pay me my slice? i help out here and have never gotten
any money from your isp. i think i will sue them and you for back pay.

in the meantime, spend your money on buying a clue.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Mon, 31 May 2004 16:09:52 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9fl9a$onm$1@news.simnet.is>

"Player" <notachance@inhell.com> wrote in message
news:c9fjr1$pts$1@newsg2.svr.pol.co.uk...
>
> C:\Scripts>perl gradehash.pl
> Enter students names (press <CTRL>+Z when done): sam tom bobZ
> Z
> Z

assuming those Z's were ^Z's, i have no idea what is going on.
it looks like your shell is not honoring the CTRL-Z's.

let's take perl out of the equation. try the command
  copy CON: blah.txt
enter a few lines of junk, ending with a line consisting
solely of CTRL-Z<enter>.
does it say '1 file(s) copied.' at that point?

this test might give us clues.
this is how it looks with me:
==
C:\perlcode>copy CON: blah.txt
oiuoiu
sdfsdf
^Z
        1 file(s) copied.

C:\perlcode>more blah.txt
oiuoiu
sdfsdf

C:\perlcode>
==

gnari






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

Date: Mon, 31 May 2004 16:18:07 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Beginner needs help with script :)
Message-Id: <c9floo$opb$1@news.simnet.is>

"Player" <notachance@inhell.com> wrote in message
news:c9fkmi$qjr$1@newsg2.svr.pol.co.uk...
> I think I figured the thing out anyways.
>
> I have to press enter or return after every entry for the grades and names
> lists and then do a CTRL+Z and then press enter/return again.
>
> If I just run the script and enter the names one after the other just
using
> space bar to seperate them instead of using enter/return, then it doesnt
> work.

you would just get the names in the first array, element, but
the following ^Z lines should have worked nevertheless.

it seems that if you end a non-empty line with ^Z,
the next line will not close the input even if it
is a single ^Z, but the next one after that will:

==
C:\perlcode>perl test.pl
Enter students names (press <CTRL>+Z when done):
asd^Z
^Z
^Z


Enter associated grades (press <CTRL>+Z when done):
==

gnari






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

Date: Mon, 31 May 2004 23:42:18 +0800
From: "Y W Wong" <ywwong_hk@hotmail.com>
Subject: Re: Login to MS Exchange to send e-mail
Message-Id: <c9fl2c$1js8$1@news.hgc.com.hk>

I am now understood that it is very difficult to do that without using SMTP
& POP3.

Thanks to all.

Yan




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

Date: Mon, 31 May 2004 17:33:21 +0100
From: bof <nothingread@hotmail.com>
Subject: reading variable and fixed length records
Message-Id: <JkVuDBHR51uAFw5X@invalid.domain>


I'm trying to read a file with records of the form:

[byteA][byteB]...[byteN][0][byte1][byte2][byte3]

i.e. an initial variable length part; a zero marker; then a fixed number 
of bytes; with no delimiter between the records.

Any pointers for a Perl noob on how to achieve this ?

MTIA


-- 
bof at bof dot me dot uk


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

Date: 31 May 2004 16:48:45 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: reading variable and fixed length records
Message-Id: <c9fnld$k13$1@canopus.cc.umanitoba.ca>

In article <JkVuDBHR51uAFw5X@invalid.domain>,
bof  <nothingread@hotmail.com> wrote:
:I'm trying to read a file with records of the form:

:[byteA][byteB]...[byteN][0][byte1][byte2][byte3]

:i.e. an initial variable length part; a zero marker; then a fixed number 
:of bytes; with no delimiter between the records.

You could set $/ to 0 and do a <>, which would get you the part up to
the 0. Then set $/ to an integer which is the size of the fixed part
of the record, and do another <> to get the fixed part.

(Setting $/ to an integer was not supported until roughly perl 5.6.)
-- 
Pity the poor electron, floating around minding its own business for
billions of years; and then suddenly Bam!! -- annihilated just so
you could read this posting.


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

Date: Mon, 31 May 2004 18:34:02 +0100
From: bof <nothingread@hotmail.com>
Subject: Re: reading variable and fixed length records
Message-Id: <QUDovIKKy2uAFwp3@invalid.domain>

In message <c9fnld$k13$1@canopus.cc.umanitoba.ca>, Walter Roberson 
<roberson@ibd.nrc-cnrc.gc.ca> writes
>In article <JkVuDBHR51uAFw5X@invalid.domain>,
>bof  <nothingread@hotmail.com> wrote:
>:I'm trying to read a file with records of the form:
>
>:[byteA][byteB]...[byteN][0][byte1][byte2][byte3]
>
>:i.e. an initial variable length part; a zero marker; then a fixed number
>:of bytes; with no delimiter between the records.
>
>You could set $/ to 0 and do a <>, which would get you the part up to
>the 0. Then set $/ to an integer which is the size of the fixed part
>of the record, and do another <> to get the fixed part.
>
>(Setting $/ to an integer was not supported until roughly perl 5.6.)

Thanks, I'll give it a go. I'd got as far as the $/ to 0 bit, but hadn't 
seen any reference to setting an integer value; though this does beg the 
question how to differentiate between requesting 13 characters and using 
"\n" as the delimiter, I guess this is through the type of the value $/ 
is set to?

-- 
bof at bof dot me dot uk


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

Date: Mon, 31 May 2004 19:47:36 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: reading variable and fixed length records
Message-Id: <2i19p0Fhos6rU1@uni-berlin.de>

bof wrote:
> I'm trying to read a file with records of the form:
> 
> [byteA][byteB]...[byteN][0][byte1][byte2][byte3]
> 
> i.e. an initial variable length part; a zero marker; then a fixed
> number of bytes; with no delimiter between the records.
> 
> Any pointers for a Perl noob on how to achieve this ?

Achieve what? Your description is not very clear.

Assuming the file may contain:

[6][5][6][0]orangeapplebanana
[4][5][6][0]bluegreenyellow

this would create an "array of arrays" with the data:

     my @records;

     while (<FILE>) {
         my ($lengths, $data) = /(.+)\[0\](.+)/;
         $lengths =~ s/\[(\d+)\]/A$1/g;
         push @records, [ unpack $lengths, $data ];
     }

     print "@$_\n" for @records;

Outputs:
orange apple banana
blue green yellow

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Mon, 31 May 2004 11:34:35 -0600
From: Bill <wherrera@lynxview.com>
Subject: Re: Removing HTML tags: is there a Perl-equivalent to PHP 'strip_tags'?
Message-Id: <f4udnVsx6PZc8SbdRVn-hg@adelphia.com>

Francesco Moi wrote:
> Hi.
> 
> I've got some HTML texts, but I want to remove HTML tags from it.
> I mean, convert '<b>foo</b>' into 'foo'.
> 
> In PHP you can use 'strip_tags':
> http://www.php.net/strip_tags
> 
> Is there any Perl-equivalent?
> 
> Thanks.
Why not google for it first?

http://groups.google.com/groups?q=perl+strip_tags&hl=en&lr=&ie=UTF-8&selm=92d64088.0309241735.7a05269c%40posting.google.com&rnum=3



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

Date: Mon, 31 May 2004 18:51:52 +0200
From: Xaver Biton <javier@t-online.de>
Subject: Re: splitting cvs file and insert in mysql via DBI
Message-Id: <c9fnr9$jlj$00$1@news.t-online.com>

Xaver Biton wrote:

  > I've to split a csv file and insert it in a mysql db. I've done some
> tests with other file and it worked wonderfull now in the real work 
> doesn't work, I' ve many errors.
> 
> The first question ist: why does perl complain when it find a "@" a "." 
> or a number in csv file. Perl  says that it find an a number or a dot 
> ...  where opeator is espected. how can I get rid of this?


Hi,

thks. everyone for the help.

Ok I've enabled strict and warnings again but didn't chanche much. I've 
a similar error:

## error message##

Can't call method "execute" on an undefined value at customers.pl line 
26, <> line 1.

##end##

this is line 26:  $sth->execute($vo_nr, $interne_customer_id, $nikname, 
$salutation, $name,
$forename, $address, $zip, $city, $tel, $telefax, $customer_since, $mail);

I run the script like this on a cygwin bash:

$perl customers.pl kunden.csv

How I said before I've done some tests with a more simple table and 
everythings work well.

It could be that some fields now in the csv file are empty? And I didn't 
declare it into the execute statement? Or more easy to say, must be 
exists a variable in the execute statement  for every value (also the 
empty ones) in the csv file? I mean if the csv file look like 
value1;value2; ;value4; my I declare like this: 
$sth->execute($value1,$value2,value4); omitting actually the value3?

The other problem is that I can't find anything also in perldoc how to 
say to perl that ".", "@", and number in csv are charachters and not 
operators.

Tad McClellan wrote:

 > What will that do with names like these?
 >
 >     Thorton Billy Bob
 >
 >     De Larenta Oscar
 >
 > Try it and see...

You are right, butI haven't find a better solution yet, and I tought in 
the worst case I will change the few names by hand. Of course would be 
nice if  you would suggest something, but I've the fear asking to much now.


thks.

Xaver


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

Date: Mon, 31 May 2004 17:31:17 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: splitting cvs file and insert in mysql via DBI
Message-Id: <c9fq1v$p95$1@news.simnet.is>

"Xaver Biton" <javier@t-online.de> wrote in message
news:c9fnr9$jlj$00$1@news.t-online.com...
> Xaver Biton wrote:
>
> Ok I've enabled strict and warnings again but didn't chanche much. I've
> a similar error:
>
> ## error message##
>
> Can't call method "execute" on an undefined value at customers.pl line
> 26, <> line 1.
>
> ##end##
>
> this is line 26:  $sth->execute($vo_nr, $interne_customer_id, $nikname,
> $salutation, $name,
> $forename, $address, $zip, $city, $tel, $telefax, $customer_since, $mail);

this is not a 'similar' error at all.

this tells us that $sth is undefined at the moment of the call,
probably because the prepare() failed. you should test the results
of the DBI connect() and prepare() functions, especially when disabling
DBI's RaiseError.

>
> I run the script like this on a cygwin bash:
>
> $perl customers.pl kunden.csv

we asked about that because the error you previously reported:
    Can't locate object method "Ilzasname" via package "Asan"
   (perhaps you forgot to load "Asan"?) at customers.csv line 1.
suggested you had done:
    perl customers.csv


gnari






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

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 V10 Issue 6633
***************************************


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