Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Output runs into prompt

by hippo (Curate)
on Jan 20, 2014 at 16:16 UTC ( #1071342=note: print w/ replies, xml ) Need Help??


in reply to Noob question

Previous answers (sensibly) recommending Cwd notwithstanding, your problem in the top example is that your output is running into your shell prompt for the following command (whatever that might be). Your chomp is removing the trailling newline that you might need to do this. You could therefore chomp after the print if that's the way you want to go about it.

However, your second script works fine if we adjust the shebang:

$ cat cwdt.pl #!/usr/bin/perl use strict; use warnings; my $currDir = `pwd`; chomp $currDir; print "$currDir\n"; $ ./cwdt.pl /tmp $

This suggests that the code you've posted may not be the code you are running.


Comment on Re: Output runs into prompt
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2014-09-16 16:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (36 votes), past polls