read and parse a single line file

Discussion in 'Perl Misc' started by Rainer Weikusat, Apr 1, 2014.

  1. Nope. The last character in the file is a \n and that's not supposed to
    be part of the $count value

    ------------
    system('echo 20140403 100 >/tmp/x');
    open($fh, '<', '/tmp/x');
    $date=substr($_,0,-2-length($count=substr($_,rindex($_,' ')+1,-1)))for<$fh>;
    printf("'%s', '%s'\n", $date, $count);
    ------------
     
    Rainer Weikusat, Apr 3, 2014
    #21
    1. Advertisements

  2. Στις 3/4/2014 22:37, ο/η Rainer Weikusat έγÏαψε:
    my file have not final \r or \n ... so a xor maybe is necessary
     
    George Mpouras, Apr 3, 2014
    #22
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.