Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: User input at runtime

by vivid (Beadle)
on Dec 13, 2007 at 05:12 UTC ( #656752=note: print w/replies, xml ) Need Help??


in reply to User input at runtime

Try this

use strict; my $arg = $ARGV[0]; open(IN,"$arg")||die("Can't open the input file for reading"); undef $/; my $str = <IN>; close(IN); $/="\n"; print ("\nDo u want to Change Example to Uppercase:"); $value = <STDIN>; chomp($value); if ($value=~/^y$/){ $str=~s/\b(example)\b/uc($1)/gei; } open (OUT,">$arg")||die("Can't open the output file for writing"); print OUT $str; close(OUT);

Vivid

Replies are listed 'Best First'.
Re^2: User input at runtime
by pop18 (Novice) on Dec 13, 2007 at 05:53 UTC
    Thank you very much VIVID...
    This stuff works as per my requirement....

    Thanks
    POP
      This doesn't bode well for your High School midterm...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://656752]
help
Chatterbox?
[oiskuu]: ... getlogin refers to tty owner; if you close STDIN, then getlogin returns undef. I get undef in my shell (running under X)
[tye]: Then there is a more persistent big of data similar to getlogin(). I don't believe even daemonizing drops it. So you can tell services that were started at boot time from those started by a person.
[tye]: I'll have to look into that later. getlogin() suites my current needs.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-06-23 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (554 votes). Check out past polls.