in reply to perl-5.8.0 print statement

It's because you aren't printing a newline after the output, which operating systems like linux require. Two ways to fix it. The easiest is to add the -l switch to perl: perl -le "print crypt('string', 'salt')". The second way is to print out a newline as well (less-cool :P): perl -e "print crypt('string', 'salt'), qq{\n}".


If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, reply to this node or /msg me to tell me what is wrong with the post, so that I may update the node to the best of my ability. If you do not inform me as to why the post deserved a downvote, your vote does not have any significance and will be disregarded.

Replies are listed 'Best First'.
Re (2): perl-5.8.0 print statement
by VSarkiss (Monsignor) on Feb 06, 2003 at 03:29 UTC
    you aren't printing a newline after the output, which operating systems like linux require.

    Sorry, that's wrong. There's no such requirement. Observe:

    bash$ uname -a Linux amano 2.4.18-3ntfs #2 Sun Jun 9 12:40:53 PDT 2002 i686 unknown bash$ perl -e "print crypt('password','A0')" A0qxUqZSv1XUUbash$
    It may look funny, but it'll print just fine regardless of whether there's a newline or not.

      you aren't printing a newline after the output, which operating systems like linux require.

      s/linux/Windows sometimes/ makes that statement correct. Though I've never figured out the details of when the missing newline presents a problem.

      I've also seen Unix shells configured with "\r" at the start of their prompts which could hide the fact that the crypted string was output.

                      - tye

      Mmm... I suppose it really does depend on the environment in which you are working. Or... what Perl version do you have installed? I've never had to add the newline in Windows XP. In any case, there are times when the newline is required. I don't know the conditions under which it is necessary, but I bet that it's the correct answer to the original poster's question. BTW, here's the output I receive:

      [root] perl -v This is perl, v5.8.0 built for i386-linux-thread-multi ............. ............. [root]# uname -a Linux [xxxx] 2.4.18-19.8.0 #1 Thu Dec 12 05:39:29 EST 2002 i686 i686 i +386 GNU/Linux [root]# perl -e "print crypt('password','A0')" [root]# perl -le "print crypt('password','A0')" A0qxUqZSv1XUU


      If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, reply to this node or /msg me to tell me what is wrong with the post, so that I may update the node to the best of my ability. If you do not inform me as to why the post deserved a downvote, your vote does not have any significance and will be disregarded.