paragkalra has asked for the wisdom of the Perl Monks concerning the following question:

Hello All,

I was coding my Perl script in Notepad++ editor and it was on verge of completion.

All of a sudden my machine rebooted. And after that I found all my data lost. It is containing series of 'NUL' characters.

However size of the Perl script is same as it was earlier.

Please help me recover my Perl script.

TIA

Parag

Replies are listed 'Best First'.
Re: Help me recover my Perl script
by CountZero (Bishop) on Dec 25, 2009 at 16:27 UTC
    "Normal" characters interspersed with "NULL" characters: that looks very much like a file with "wide" (or multi-byte) characters such as Unicode uses.

    Did you try opening the file with the (regular) Windows Notepad? Version 5.1 (part of Windows XP) allows you to choose the encoding when opening and saving files.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Help me recover my Perl script
by Old_Gray_Bear (Bishop) on Dec 25, 2009 at 12:05 UTC
    I suspect that you are toasted, unless you have the auto-save plugin installed; you will just have to re-enter your code. My preferred editor (vim) is configured to auto-save every minute because I too was burned this way, Back In the Day....

    ----
    I Go Back to Sleep, Now.

    OGB

      I had been saving my file constantly.

      It is just not containing what it should contain.

        It is just not containing what it should contain.

        What should it contain (don't say your script, describe the bytes)?

        Did you try running strings command on the file?. It may strip non-printable characters
Re: Help me recover my Perl script
by Anonymous Monk on Dec 25, 2009 at 05:52 UTC
    contact Notepad++ support? run through iconv?
Re: Help me recover my Perl script
by Khen1950fx (Canon) on Dec 25, 2009 at 08:13 UTC
    I use the Bluefish editor. If I click on File, it'll show "open recent" or "open location". Does Notepad++ have that? Try it if it does. Merry Christmas!
      I've heard it doesn't, but it might keep auto-backups (if you turned it on) somewhere in %temp%
Re: Help me recover my Perl script
by Jorge_de_Burgos (Beadle) on Dec 25, 2009 at 22:38 UTC
    Would you send me the file so I try to get something out of it for you as a Christmas present?
Re: Help me recover my Perl script
by paragkalra (Scribe) on Dec 25, 2009 at 06:01 UTC

    Can anyone please guide me on how to use 'iconv'.

    If I am not wrong its a Linux command.

Re: Help me recover my Perl script
by paragkalra (Scribe) on Dec 25, 2009 at 06:43 UTC

    All I want to know is what should be my input and output file format while using 'iconv' with Perl script.

      whatever Notepad++ thinks it should be?
Re: Help me recover my Perl script
by paragkalra (Scribe) on Dec 27, 2009 at 11:19 UTC

    When I try to view my roasted file through 'less' command I get following output:

    # less Test.pl

    "Test.pl" may be a binary file. See it anyway?

    Is there a way I can convert this binary file to its initial readable state.

    @Jorge_de_Burgos - Thanks for your courtesy. BTW how can I share my script with you. Can you please PM your email ID to me.

      Try running the following with your scriptfile

      perl -pi.bak -e 's/\0//g' scriptfile

      You will have a backup copy after that, appropriately named scriptfile.bak.