Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: New student, can we write this program in perl...

by MidLifeXis (Monsignor)
on Oct 19, 2012 at 16:49 UTC ( #999981=note: print w/ replies, xml ) Need Help??


in reply to New student, can we write this program in perl...

I would use grep and the % operator. Could also do it with the ternary operator and the % operator (although that is approaching too cute to maintain).

Update: based on other provided information in this thread, you may also want to see print, join, say, and chomp.

--MidLifeXis


Comment on Re: New student, can we write this program in perl...
Re^2: New student, can we write this program in perl...
by rahulraina7 (Initiate) on Oct 19, 2012 at 16:52 UTC
    how do i input array of n numbers in perl sir ..?

      my @data = <> would be one way. Could always read one line at a time with while (<>) {...}. This is stuff that you or your instructor should have already covered in your course, isn't it?

      Update: if not, take a look at perlintro, perlfaq, perlsyn, perldata, and so on.

      --MidLifeXis

        In india we do have to do lots of research work like this, blame it to the poor teaching system.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2015-07-04 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls