add a "suffix" to a variable in a array

From: Laura (handl_at_mts.net)
Date: 07/27/04

  • Next message: Gunnar Hjalmarsson: "Re: Hrs of work on regex: please help"
    Date: 26 Jul 2004 17:52:31 -0700
    
    

    I dont know if I can explain this correctly by here goes.
    I am trying to write a perl program that takes a file let say it looks
    like this...
    xxxx001,00 0 05 21,TELN NOT
    xxxx002,00 0 01 30,TELN NOT
    xxxx008,00 0 04 15,TELN NOT
    xxxx013,00 0 02 30,CUST HAS
    xxxx015,00 0 10 22,CUST HAS

    I want to also insert a few things to this file...
    I want to prompt user to enter in
    print "Enter BLD:"; $bld=<STDIN> ; chomp $bld;
    print "Enter ROOM:"; $ROOM=<STDIN> ; chomp $ROOM;

    Also I want a areacode fixed to the first column so when all is said
    and done, I have part of the script but can not add the areacode to
    it???

    #!/opt/perl/bin/perl
    $acode="204";
    print "Enter BLD:"; $bld=<STDIN> ; chomp $bld;
    print "Enter ROOM:"; $room=<STDIN> ; chomp $room;
    while(<ARGV>) {
    chomp;
    @a=split(",",$_);
    print join(",",$a[0],$bld,$room,$a[1],$a[2],$a[3],"\n") ;

    How do I add 204 at the beginning of the [1]?

    204xxxx001,EAST_BLD,ROOM1,00 0 05 21,TELN NOT


  • Next message: Gunnar Hjalmarsson: "Re: Hrs of work on regex: please help"

    Relevant Pages

    • add a "suffix" to a variable in a array
      ... I dont know if I can explain this correctly by here goes. ... I am trying to write a perl program that takes a file let say it looks ... I have part of the script but can not add the areacode to ...
      (comp.lang.perl.misc)
    • Re: print 2 valuable
      ... your perl program assigns the string "cold1man\n" to the variable $a. ... need to chomp the variables first before you can use them: ...
      (perl.beginners)
    • Re: print 2 valuable
      ... your perl program assigns the string "cold1man\n" to the variable $a. ... You need to chomp the variables first before you can use them: ...
      (perl.beginners)
    • Re: [PHP] Passing vars w/refresh w/register globals off?
      ... Dont know why you want to, ... This wasy all you need is pass the ID within the browser. ... > switch for routing to desired pages according to form input data. ... I'm thinking the old script would be php3 and the new ...
      (php.general)
    • Re: Looking for maybe impossible script?
      ... The admin rights on the laptops were ... Even if i could get a script that would notify me of such ... I just dont have the time. ... aide fix and tracing them down to the port an then shuting it off. ...
      (microsoft.public.windows.server.scripting)