Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Beginner needs help with script :)

Reply
Thread Tools

Beginner needs help with script :)

 
 
Player
Guest
Posts: n/a
 
      05-31-2004
Hello all

I am teaching myself perl, with the help of a few texts/tutorials and a
book.
I have installed the latest Activestate perl build ActivePerl 5.8 on my
WindowsXP Pro machine.
Everything seemed to be going alright with the first few scripts, up untill
I did this one.

%grades=();

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

@grades{@names} = @scores

The problem is when I am inside the command prompt window and run the
script, i called it gradehash.pl, it runs fine to the first stdin line were
after I have finished entering the names to go into the @names list, I have
to press <CTRL>+D in order to stop that stdin and the script to go onto the
next line.
By pressing <CTRL>+D alls I get is this ^D coming up insteadof it
stopping the stdin and going to run the next line of the script.

Can anyone help me?
Can I only use <CTRL>+D on a linux setup? and if so what is the windows
alternative for what I am trying to do in those lines?

Thanks in advance
Player




 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      05-31-2004
Player wrote:
> Hello all


Don't post the same question in different messages to multiple newsgroups!

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

 
Reply With Quote
 
 
 
 
gnari
Guest
Posts: n/a
 
      05-31-2004
"Player" <(E-Mail Removed)> wrote in message
news:c9f1m7$meh$(E-Mail Removed)...
> Hello all
>
> I am teaching myself perl, with the help of a few texts/tutorials and a
> book.
> I have installed the latest Activestate perl build ActivePerl 5.8 on my
> WindowsXP Pro machine.
> Everything seemed to be going alright with the first few scripts, up

untill
> I did this one.
>
> %grades=();
>
> print "Enter students names (press <CTRL>+D when done): ";
> @names = <STDIN>;
> chomp @names;
> print "\n\n";
> print "Enter associated grades (press <CTRL>+D when done): ";
> @scores = <STDIN>;
>
> @grades{@names} = @scores


this tutorial seems to be written for unix-like operating
systems.

on unix CTRL-D is an end of file character. a similar character
on windows is CTRL-Z

this tutorial is just to demonstrate how <> work in a
list context (read whole file). it is dubious technique to use
this for interactive user input.

gnari



 
Reply With Quote
 
Paul Lalli
Guest
Posts: n/a
 
      05-31-2004
On Mon, 31 May 2004, Player wrote:

> Can anyone help me?
> Can I only use <CTRL>+D on a linux setup? and if so what is the windows
> alternative for what I am trying to do in those lines?


The windows equivalent of CTRL-D is CTRL-Z <enter>

Paul Lalli
 
Reply With Quote
 
Player
Guest
Posts: n/a
 
      05-31-2004

"Gunnar Hjalmarsson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Player wrote:
> > Hello all

>
> Don't post the same question in different messages to multiple newsgroups!
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
>


Its a legitimate question posted in two appropriate news groups.
There is nothing wrong with that what-so-ever, as I am subscribed to both
news groups and the news groups in questions are both there to offer help
and advice on perl.
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.
Player


 
Reply With Quote
 
Player
Guest
Posts: n/a
 
      05-31-2004

"Paul Lalli" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed).. .
> On Mon, 31 May 2004, Player wrote:
>
> > Can anyone help me?
> > Can I only use <CTRL>+D on a linux setup? and if so what is the windows
> > alternative for what I am trying to do in those lines?

>
> The windows equivalent of CTRL-D is CTRL-Z <enter>
>
> Paul Lalli


Thank Paul I will try that out
Regards Player


 
Reply With Quote
 
Player
Guest
Posts: n/a
 
      05-31-2004

"Paul Lalli" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed).. .
> On Mon, 31 May 2004, Player wrote:
>
> > Can anyone help me?
> > Can I only use <CTRL>+D on a linux setup? and if so what is the windows
> > alternative for what I am trying to do in those lines?

>
> The windows equivalent of CTRL-D is CTRL-Z <enter>
>
> Paul Lalli


No Paul <CTRL>+Z simply did the same as <CTRL>+D did, only it displayed ^Z
instead of ^D
I don't understand this at all lol, as <CTRL>+C sends the sig term to quit
the script ok, but the ctrl+d or ctrl+x simply print ^d and ^x respectively
on the command console.

Anyone no what I am doing wrong here?
Regards Player


 
Reply With Quote
 
Paul Lalli
Guest
Posts: n/a
 
      05-31-2004
On Mon, 31 May 2004, Player wrote:

> "Gunnar Hjalmarsson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Player wrote:
> > > Hello all

> >
> > Don't post the same question in different messages to multiple newsgroups!

>
> Its a legitimate question posted in two appropriate news groups.


No one's claiming it's not.

> There is nothing wrong with that what-so-ever, as I am subscribed to both
> news groups and the news groups in questions are both there to offer help
> and advice on perl.


No one's opposing that position either.

What Gunnar is telling you is that posting the same question IN TWO
DIFFERENT MESSAGES is rude. The correct etiquete is to type ONE message,
listing both groups in the Newsgrps: or To: header. That way, people who
subscribe to both groups don't have to see the same post twice. Please
learn to follow established Usenet proticol.


> 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.



Now *that* was extraordinarily rude, uncalled for, and will likely prevent
many more people from trying to help you in this group.

Good day.
 
Reply With Quote
 
gnari
Guest
Posts: n/a
 
      05-31-2004
"Player" <(E-Mail Removed)> wrote in message
news:c9f4g2$e34$(E-Mail Removed)...
>
> "Paul Lalli" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed).. .
> > On Mon, 31 May 2004, Player wrote:
> >
> > > Can anyone help me?
> > > Can I only use <CTRL>+D on a linux setup? and if so what is the

windows
> > > alternative for what I am trying to do in those lines?

> >
> > The windows equivalent of CTRL-D is CTRL-Z <enter>
> >
> > Paul Lalli

>
> No Paul <CTRL>+Z simply did the same as <CTRL>+D did, only it displayed

^Z
> instead of ^D
> I don't understand this at all lol, as <CTRL>+C sends the sig term to quit
> the script ok, but the ctrl+d or ctrl+x simply print ^d and ^x

respectively
> on the command console.
>
> Anyone no what I am doing wrong here?


are you sure the CTRL-Z is the only character in the line?

gnari




 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      05-31-2004
Player wrote:
> Gunnar Hjalmarsson wrote:
>> Don't post the same question in different messages to multiple
>> newsgroups!

>
> Its a legitimate question posted in two appropriate news groups.


I did not claim otherwise.

> There is nothing wrong with that what-so-ever, as I am subscribed
> to both news groups and the news groups in questions are both there
> to offer help and advice on perl.


You obviously haven't learned to distinguish between cross-posting and
multi-posting. For good reasons, multi-posting is considered wrong by
the netiquette guidelines.

http://asg.web.cmu.edu/rfc/rfc1855.html

<rambling snipped>

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner needs help getting script to work in Safari 1.0.2 Kim Forbes Javascript 5 10-18-2004 03:11 PM
A beginner needs help! Chung Hang Shum ASP .Net 3 09-10-2004 11:18 PM
beginner needs help planning website Peter HTML 10 02-07-2004 01:53 AM
Beginner needs help. *SOME* https sites inaccesible through router ??? big chris Cisco 4 01-18-2004 11:30 PM
Beginner needs help -- Simple AspNet Component Jim H ASP .Net 1 07-17-2003 04:37 AM



Advertisments