Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Perl Issue - File downloaded in windows has a Control M character in it??

by venky144 (Initiate)
on Oct 24, 2012 at 20:49 UTC ( #1000715=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl Issue - File downloaded in windows has a Control M character in it??
in thread Perl Issue - File downloaded in windows has a Control M character in it??

thanks...your solution worked well... LWP Simple worked... here is the modified code and it worked well..perl seems interesting

use Storable; use LWP::Simple; #--------------------------------------------------------------------- +--------- # Define Variables for this process #--------------------------------------------------------------------- +--------- # File Down load path is used as a varible: $DownloadFilePath=<Path na +me> $DownloadFilePath="D:\\LIPAPSM\\DSSourcefiles\\"; #===================================================================== +========= # START OF PROGRAM #===================================================================== +========= $one_day = 60*60*24 ; my($day, $month, $year) = (localtime time+$one_day)[3,4,5]; $month = sprintf '%02d', $month+1; $day = sprintf '%02d', $day; $Datetotal=($year+1900).$month.$day; $filedate=join "", $Datetotal."damlbmp_zone.csv"; $url = join "",'http://mis.nyiso.com/public/csv/damlbmp/'.$filedat +e; $filename=join "",$DownloadFilePath.$filedate; mirror($url, $filename)


Comment on Re^2: Perl Issue - File downloaded in windows has a Control M character in it??
Download Code
Re^3: Perl Issue - File downloaded in windows has a Control M character in it??
by fishmonger (Friar) on Oct 24, 2012 at 21:00 UTC
    Now lets cleanup that messy filedate code.
    use POSIX qw(strftime); my $filedate = strftime("%Y%m%d", localtime(time() + 86400));
      can you please update my complete code with the filedate.. what is the mess that's filedate creates...
      i didnt understand this one...my script is working fine..why do i need to add this again??
Re^3: Perl Issue - File downloaded in windows has a Control M character in it??
by hbm (Hermit) on Oct 24, 2012 at 21:24 UTC

    And these lines are odd - you join strings with 'join' and '.':

    $filedate=join "", $Datetotal."damlbmp_zone.csv"; $url = join "",'http://mis.nyiso.com/public/csv/damlbmp/'.$filedate; $filename=join "",$DownloadFilePath.$filedate;

    You can simply quote them as one:

    $filedate = "${Datetotal}damlbmp_zone.csv"; $url = "http://mis.nyiso.com/public/csv/damlbmp/$filedate"; $filename = "${DownloadFilePath}$filedate";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2015-07-07 09:46 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 (88 votes), past polls