Small help is needed

hi guys
I have a small perl prgram which accept two number and print their sum.
the following is perl program.
$y=<>;
$x=<>;
chomp($y);
chomp($x);
$sum=$x+$y;
print $sum;
when I run it from prompt. It waits for the user to enter two numbers and the print their sum.
now I would like to execute this program from java using exec command.
how I can pass the two numbers to the program
I tried the following but DOES not work
Runtime.getRuntime().exec("perl example.pl 8 9 ");
any help

Mmmmm.......research.......
The use of STDIN is one way to get information interactively from a user. For some purposes though the use of command-line arguments may be more convenient. What happens here is that a user runs the script with certain arguments after the script name:
perl my_script.pl 34 66 dallas
and the arguments 34, 66, and dallas are captured and subsequently used in your program. How this can be done with Perl is through the use of a special array called @ARGV which Perl will create when the script is run; the elements of @ARGV are the command-line arguments used (if any) when the script was invoked. For example, if we had a script
for my $arg (@ARGV) {
print qq{You passed in $arg\n};
and ran it as perl my_script.pl 34 66 dallas, then we would find as output
You passed in 34
You passed in 66
You passed in dallas

Similar Messages

  • Need small help

    Hi,
    I need small help in sql*loader.I get data-files which has a particular identified on the 1st record( header ), based on which I've to load a constant for the 1st column of every row. How do I set in the control file.
    Appreciate if someone can give me directions on this.
    Thanks in advance,

    Hi again!
    I hope that a little shell script will do the thing for you.
    1.) Create the following BASH-Script
    #!/bin/bash
    export CUSTNO=""
    export CUSTNO=$(awk -F"," '{print NR " " $3}' datafile.csv | grep 1 | cut -d" " -f2)
    sed -i 's/#x#/'$CUSTNO'/g' controlfile.datI've use datafile.csv as the name of the datafile to load and controlfile.dat as the name of your controlfile. Please change this to fit your needs.
    This script looks for the occurrence of your constant value and stores this value in the variable CUSTNO. Then it look for a string #x# in your controlfile and changes #x# to the value of CUSTNO.
    So in your controlfile there should be a line for custno like that:
    custno                     CONSTANT '#x#'This line will be replace in your example to:
    custno                     CONSTANT '35642'To get this to work I assume that:
    1.) Your constant value is always at the third position in the header of your datafile.
    2.) You've made the change with #x# in your controlfile.
    I hope that this is really usefull to you.
    Best Regards
    Florian W.

  • I don't know if this is a Firefox problem so I ask, When printing how come it always prints so small I nearly need a magnafing glass? Is this caused by something else I may have set incorrectly? help please, from a very satisfied Firefox user

    I don't know if this is a Firefox problem so I ask, When printing how come it always prints so small I nearly need a magnifying glass? Is this caused by something else I may have set incorrectly? help please, from a very satisfied Firefox user

    This only happens when I'm in my browser. Ex. when I'm on a site and I decide I like what I see and want to print it text that is, my printer always prints tiny. When I'm in Microsoft Word for ex. I print it and it looks like what I expect. So I don't know if somehow my printer got set to print tiny when on the web. If you can help me I would be most appreciative. Thanks again for your response.

  • Help need small help

    ferst this is my pc
    4.09.00.0904 (DirectX 9.0c) ante-HA0X2NT8F0  : CPU الـ Intel Pentium 4 530, 3033 MHz (15 x 202) MSI 848P Neo-V (MS-6788) (5 PCI, 1 AGP, 2 DDR DIMM, Audio)  Intel Breeds Hill i848P ram512 mb(DDR SDRAM) BIOS نوع الـ AMI (11/29/04) Communications Port (COM1) ECP Printer Port (LPT1) RADEON 9250 - Secondary (128 mb) RADEON 9250 (128 mb) ATI Radeon 9250 (RV280) Plug and Play Monitor [NoDB] (105169121) : sound cart Intel 82801EB ICH5 - AC'97 Audio Controller
     : IDE  Standard Dual Channel PCI IDE Controller Floppy disk drive HDS728080PLAT20 (قب 80, 7200 RPM, Ultra-ATA/133)   CD-ROM Drive SMART
    now
    1-my pc restart it self after 4 or 5 h....
    no cbu hot
    no fan error cut i test all
    2-i wanna get update all driver
    i try with the msi brogram and that brogram give me an old v. :((
    3-is my pc (top)(good)(strong) if not i will buy new msi one only tell me
    waiting

    when take look thare i see 12v_____
    euer-power tx 12v
    pl-350 8a 5a max 200w (isthat good )?
    hi Din
    let me ask how i can do this ?(memtest )????
    pls i wanna small help and i wanna know >is my pc good or bad cuz it cust me mush
    and all my pc from MSI !.
    HI Ralphdb
    (((Do you know what temp your Cpu is running)))) no i dont know that i am not professional  in pc hard..so pls be soft with me and explain  ...

  • My phone 5s did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.

    My phone 5s 16gb gold did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.   This phone is not even 6 months old been in case no scratches. This is driving me crazy.

    Connect your phone to a computer and restore your software using iTunes.

  • In the new mail app for OSX v10.7 Lion it seems I can only setup my gmail account as an "imap", when I need to set it up as "pop"... PLZ HELP I NEED MY MAIL TO WORK!!!

    In the new mail app for OSX v10.7 Lion it seems I can only setup my gmail account as an "imap", when I need to set it up as "pop"... PLZ HELP I NEED MY MAIL TO WORK!!!

    Go to System prefs
    Select Mail Contacts and Calendars
    Then select Other
    Then select "Add a Mail Account and click create
    Then go to google for the settings you need:
    First here for the settings online at gmail http://tinyurl.com/du3fu
    Then here for the setting in mail http://tinyurl.com/38fevm8
    These are instructions for Mail 4.0 but all of the necessary settings should be listed.

  • Help, I need to run three displays on my Mac Pro 4,1.

    Help, I need to run three displays on my Mac Pro 4,1.
    I have a Radeon 5870 installed with OS X 10.8.3
    need to run a Dell 30 inch dislay, a 19 inch Eizo and a 12 inch Cintiqu Display Tablet please.
    Ant tipes or hints?  Failing that, I would like to know of a comptaible video/graphic card which will only take up an additional slot, as I have the others filled with eSata and USB 3 cards.
    Cheers
    David

    Your 5x70s support three monitors. Are you having trouble?
    Answered just last night in this thread also
    https://discussions.apple.com/thread/4933924?tstart=0

  • Windows XP Clean Install – What I discovered and the help I need

    Windows XP Clean Install – What I discovered and the help I need
    I previously had a problem with my Laptop dying randomly you can read about it in the thread entitled Computer dies Randomly (Battery also dead) click to view
    Before I realised the solutions, I thought that maybe my Laptop had become infected with a Virus and decided it would be prudent to do a clean install of the Windows XP operating system.
    Everything went perfectly and thought a clean install was a good opportunity to download the “XP Service Pack 3” SP3 and did so, it seemed very quiet though and that’s when I realised I had no sound…
    I downloaded all of the sound drivers I could find on the Lenovo site for 3000 N100 (I knew from previous experience that the “SOUNDMAX” driver is the only one that actually works with this 3000 N100) in order to install this you have to install the Realtek HD audio driver, but in order to install that you have to install some other Driver/Soft that only works with SP1 or SP2 if you try to install it with SP3 it will say that you don’t need the file as your Service pack is newer than the file you want to install, this is understandable as SP3 is not final as of yet (but it’s good to know).
    My next problem was that my extra RAM was not detected, this was fixed by updating the BIOS, after installing all of the System updates, PC Doctor, everything I could find for 3000 N100 I decided to rest, I pushed the Lenovo care button and it did not work, I found a hot key driver and installed it but still the Lenovo care button does not work, previously when I pushed this button it would bring up the Lenovo menu but now it’s just a dead button, Does anyone know how to get this button working again?
    I am pretty sure that everything else is working fine now, just that button not working is very annoying, is there a set routing of installs you must do to get everything working, i.e. bios 1st audio 2nd system update 3rd etc...
    Please help, I hope I have helped you...
    Message Edited by DrunkenNinja on 05-07-2008 03:38 AM
    Message Edited by DrunkenNinja on 05-07-2008 03:38 AM
    Solved!
    Go to Solution.

    Ok first everything works now... except the Lenovo Care button, I just posted the other stuff cause it might help other members,  I have searched the forum for an anwser to this problem but there was only one anwser (suggesting to uninstall the driver restart and re-install it) and it did not result in a working Lenovo Care button...
    I don't beleive the Lenovo keyboad drivers are in any way related to the Service pack 3 as they do not use the Service pack files, to back this up I also had the same problem when Service Pack 2 was installed...
    The Lenovo Care button works fine on Boot up screen to access the rescue and recovery software (So the mechanics of the button are fine) but once Windows XP loads it is just a dead button, I remember it used to open up the Lenovo Care Start bar, I got it working once in the past but I can't remember what I did, I thought someone here might know the anwser...

  • I have a new Ipad and when I try to buy an app it asks for my  questions! I dont remember them so I press the button that send me an email to reset them. Ive sent it various times but it doesnt arrive. please help I need this app for school!!!

    I have a new Ipad and when I try to buy an app it asks for my  questions! I dont remember them so I press the button that send me an email to reset them. Ive sent it various times but it doesnt arrive. please help I need this app for school!!!

    See Kappy's great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
     Cheers, Tom

  • I am using windows 7 and itunes 11.7 my i phone 5s is not getting synced with my laptop it keeps showing backing up  please help i need to put music in my phone?

    i am using windows 7 and itunes 11.7 my i phone 5s is not getting synced with my laptop it keeps showing backing up  please help i need to put music ?

    Hi,
    Have you managed to solve this problem? if yes, please highlight how you solved it...i'm facing same problem with my new Iphone 5S but udner Windows, thanks.

  • I recently purchased a Canon 7D. I own Adobe Photoshop/Bridge CS5. I cannot open my raw images in Bridge. I have tried to download the plug in but does not seem to work. Please Help, I need to be able to open my raw images in Bridge ASAP. I do not want to

    I recently purchased a Canon 7D. I own Adobe Photoshop/Bridge CS5. I cannot open my raw images in Bridge. I have tried to download the plug in but does not seem to work. Please Help, I need to be able to open my raw images in Bridge ASAP. I do not want to upgrade to CS6 at this time.

    If you had given us sensible information, I could look it up for you if your efforts fail.
    Right now, I don't even know if you are on a Mac or on a Windows box.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand, such as your platform (Mac or Win), exact versions of your OS, of Photoshop and of Bridge, machine specs, what troubleshooting steps you have taken so far, what error message(s) you receive, if having issues opening raw files also the exact camera make and model that generated them, etc., someone may be able to help you.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • My BB9810 refuse to load OS7.1 software on my phone after the download has completed. My phone has freezed/stucked since morning. Pls urgent help/assistant needed as I can not access/use my phone for over 24hrs now.

    My BB9810 refuse to load OS7.1 software on my phone after the download has completed. My phone has freezed/stucked since morning. Pls  urgent help/assistant needed as I can not access/use my phone for over 24hrs now.

    Hi there,
    Use the method described in the link below to get back up and running:
    http://supportforums.blackberry.com/t5/Device-software-for-BlackBerry/How-To-Reload-Your-Operating-S...
    I hope this info helps!
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

  • Help urgently needed, I have installed Logic Pro 9, since then my Final Cut Pro X keep freezing. Anyone what is wrong and how to solve it? I desperately need help on this. Thanks

    Help urgently needed, I have installed Logic Pro 9, since then my Final Cut Pro X keep freezing. Anyone what is wrong and how to solve it? I desperately need help on this. Apple support says I have to pay £85 for to help me. Thanks

    Just a word of advice. Never ever use the word "urgent" on this forum

  • Please Help , I Need semicolon ; after TABLESPACE "MFEED_DATA"

    Hi All,
    please Help , I Need semicolon ; after TABLESPACE "MFEED_DATA"
    as I am getting ; like below example
    select dbms_metadata.get_ddl('TABLE', 'A') || ';' As Result
    from dual;
    CREATE TABLE "MFEED"."A"
    (     "A" NUMBER
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "MFEED_DATA"
    regards,

    Hi,
    well, I don´t know if this works for any table, but I tried two of mine and it was ok:
    select substr(dbms_metadata.get_ddl('TABLE', '<table_name>'), 1,
    length(dbms_metadata.get_ddl('TABLE', '<table_name>') || ';')-4)|| ';' As Result
    from dual;
    If the string gets too long, you must use dbms_lob - functions for string manipulation, but for "normally sized" tables, it should work.
    Regards,
    Gerd
    Message was edited by: Gerd
    OK, Jens has the perfect solution - forget mine!
    gerd_99

  • Please help i need a sourcecode i think it�s easy

    Please help
    i need the source code
    for a programm
    which should ask me for a number
    for instance: "7"
    and then should the programm write "seven"
    please help

    I wrote it as a test some time ago:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class N2t extends Frame 
         Panel pr = new Panel();
         TextField fin = new TextField(20);
         Label     fot = new Label();
         Button    but = new Button(" Go ");
         Vector    vy  = new Vector();
         Vector    va  = new Vector();
         Vector    vh  = new Vector();
    public N2t()
         super();
         setBounds(10,10,550,200);     
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
                   dispose();     
                   System.exit(0);
         pr.setBackground(Color.pink);
         add(pr);
         pr.setLayout(null);
         fin.setBounds(10,20,100,20);
         fot.setBounds(10,50,500,20);
         fot.setBackground(Color.white);
         but.setBounds(10,90,100,20);
         pr.add(fin);
         pr.add(fot);
         pr.add(but);
           setVisible(true);
         vy.add("");
         vy.add("one");
         vy.add("two");
         vy.add("three");
         vy.add("four");
         vy.add("five");
         vy.add("six");
         vy.add("seven");
         vy.add("eight");
         vy.add("nine");
         vy.add("ten");
         vy.add("eleven");
         vy.add("twelve");
         vy.add("threaten");
         vy.add("fourteen ");
         vy.add("fifteen");
         vy.add("sixteen");
         vy.add("seventeen");
         vy.add("eighteen");
         vy.add("nineteen");     
         va.add("twenty");     
         va.add("threaty");
         va.add("fourty ");
         va.add("fifty");
         va.add("sixty");
         va.add("seventy");
         va.add("eighty");
         va.add("ninety");     
         vh.add("");
         vh.add("Tousend");
         vh.add("Milion");
         but.addActionListener(new ActionListener()
         {     public void actionPerformed(ActionEvent be) 
                   calc();
    private void calc()
         int i=0, m=0, y;
         try
               i = Integer.parseInt(fin.getText());
         catch(NumberFormatException e) {return;}
         String txt = "";
         while (i > 0)
              y = i%1000;
              i = i/1000;
              if (y > 0) txt = calcI(y)+" "+(String)vh.get(m)+" "+txt;
              m++;
         fot.setText(txt);     
    private String calcI(int i)
         String txt = "";
         if (i > 99)
              txt = (String)vy.get(i/100)+" Hundred ";
              i = i%100;
         if (i > 19)
              i = i - 20;
              int a = i / 10;
              i = i - (a * 10);
              txt = txt+(String)va.get(a)+" ";
         return(txt+(String)vy.get(i));     
    public static void main (String[] args)
         new N2t();  
    Noah

Maybe you are looking for

  • How can I delete rows in a table from the bottom?

    I have table that I add rows to and I want to remove rows starting with the last row. For example if I have a table with 20 rows how do I remove rows 16-20. I can't figure out how to do this.

  • ConfigTool Login problem..SecStore.Properties file is missing..!

    hi all, I am unable to open Configtool since the SecStore.Properties file is missing which is supposed to be available in /sapmnt/<SID>/global/security/data/SecStore.properties.. Below is the error being thrown while starting configtool.sh... Error w

  • LR not recognizing external disc as external.

    When I updated LR from 1 to 2, I found that it decided that my external disc (LaCie D2 Quadra, USB connection) was actually internal. It is listed as Macintosh HD/Users/Volumes/Firewire 500Gb. I asked at the time for any ways to correct this, but des

  • FYI - High precision data issue with sdo_anyinteract on 11.2.0.3 with 8307

    For anyone that may happen to be experiencing issues with SDO_ANYINTERACT on 11.2.0.3 with high-precision geodetic data, I currently have a service request in to fix it. The issue we have is with locating small polygons ("circles" from 0.5"-4") in th

  • Unexpected pop-up: You can't open the application tar

    When running Safari, occasionally a message pops up saying "You can't open the application tar because PowerPC applications are no longer supported." As I recall, the messages appears many times while installing updates. I have Mac OS X 10.7.5 on a M