GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  Perl
Next Question 
 Perl  |  Question 1 of 61    Print  
Here is a Perl Problem that was posed to me. I was given one day time to solve.  Unfortunately I did not know enough Perl to do it. And  sadly, I did not get selected.  However I wish to share this question with all. Please pose your answers or programs on this forum for the benefit of all friends. Submitted by  ilangocal.

Here is the link for the full questions in exforsys forum, see if you can answer ttp://www.exforsys.com/forum/showthread.php?t=499



  
Total Answers and Comments: 1 Last Update: April 16, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 07, 2005 12:30:31   #1  
Vadivel raja        

RE: Here is a Perl Problem that was posed to me. I was...

i think the problem is straight forward and should be very simple to write a perl program for the same below is the program. i havent run it to check if it works fine. comments are welcome

1. Assuming table 1 having the address has a structure

address_tbl (mailaddress char(255))

2. Assuming table 2 having the count of domains has a structure

domain_count_tbl (domain char(255) count int)


@maillist query( select * from address_tbl )

for(i 0;i<scalar(@maillist;i++)
{
(name domain) split(/@/ myvar[i])
mylist[domain]++
}

foreach $key (keys mylist)
{
@res query( select 1 from domain_count_tbl where domain $key )
if (scalar(@res) 0 )
{
query(insert into domain_count_tbl values( $key mylist[$key]))
}
else
{
query(update domain_count_tbl set count mylist[$key] where domain $key )
}
}


 
Is this answer useful? Yes | No

 Related Questions

Here is a Perl Problem that was posed to me. I was given one day time to solve.  Unfortunately I did not know enough Perl to do it. And  sadly, I did not get selected.  However I wish to share this question with all. Please pose your answers or programs on this forum for the benefit of all friends. Submitted by  ilangocal.
Here is the link for the full questions in exforsys forum, see if you can answer ttp://www.exforsys.com/forum/showthread.php?t=499 

What's the significance of @ISA, @EXPORT @EXPORT_OK %EXPORT_TAGS list & hashes in a perl package? With example?

Latest Answer : The other trick is to use http://www.freetds.org/ for your sybase driver (M$SQL is just an old version of sybase that has been heavily modified).  Then standard DBI calls work.  Here is a program to login to an SQL server and print success if ...
Read Answers (3) | Asked by : Mehul

Latest Answer : There's also:-T for taint mode for security/input-checking-W for show all warnings mode (or -w to show less warnings) ...
Read Answers (2) | Asked by : suseel

Latest Answer : When to use Perl1. For large text processing2. When application does lot of data manipulation3. When you need fast development4. For database loading operations5. When shell scrits grow to become libraries ...
Read Answers (3) | Asked by : suseel

Latest Answer : * PERL is programmer friendly. It is easy to code and can do it in less number of lines. It does all the nice things with minimum fuzz.* Text manipulation is unmatched. * It has built-in regex.* Has the support of world's largest archive of modules(CPAN) ...
Read Answers (5) | Asked by : suseel

Latest Answer : HiThe faviurite module is undoubtly CGI.pmIt simplifies the coding as we no need to worry about the intricacies involving the form processing etc.Thanks,Abhishek jain ...
Read Answers (1) | Asked by : suseel

Latest Answer : hi! perldoc is best help to perl. ...
Read Answers (4) | Asked by : suseel

Latest Answer : When you are developing an application for a real time system in which processing speed is of utmost importnace ...
Read Answers (2) | Asked by : suseel

Latest Answer : You to install the appropriate driver for DB so that the connection can be make, just like ODBC drivers for each DB interface are needed... ...
Read Answers (3) | Asked by : suseel


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

Working with XML in Perl

Working with XML in Perl Extensive Markup language or the XML is a sort of data storage; it is very structured and mapped out There are two most important aspects of XML that has to be covered one is writing in XML and reading it out in XML Parsers have already been created in XML and knowing how t
 

SQL Perl/PL Overview

Procedural languages provide the fundamental method for programming within an SQL database. In other articles in this series, we have covered the SQL-based procedural languages, but those are generally not the only procedural languages found in an SQL database. Procedural extensions for Perl and Jav
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school&rsquo;s al
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.&nbsp; By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.&nbsp; IT Certification offers several vari
 

Supply Chain Management Degree Programs

Supply Chain Management Degree Programs What a Supply Chain Manager Does Every business must have supplies and materials in order to run a successful operation Supply chain managers are employed to ensure that needed suppliers are always available to employees The job entails dealing with suppliers
 

Using UML with PHP and Perl

Using UML with PHP&nbsp; and&nbsp; Perl The Unified Modeling Language has a number of features that could be beneficial to both Perl and PHP users If you have a meeting with managers and you need to explain the procedure for online credit card payments your audience could become bored While
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape