Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Pattern Matching #1

by vroom (His Eminence)
on Nov 27, 1999 at 22:04 UTC ( [id://1018]=note: print w/replies, xml ) Need Help??


in reply to Pattern Matching Exercises

# this programs prompts a user for a filename and then # replaces all tabs in that file with 3 spaces. print "\nWhat file do you want to 'detabify'? "; my $file = <>; chomp $file; # set the input record separator so that <> reads the entire file at o +nce local $/ = undef; open FILE, "< $file" or die "error reading $file - $!"; my $text = <FILE>; # the entire file contents close FILE; $text =~ s/\t/ /g; # replace each tab with three spaces open FILE, "> $file" or die "error writing $file - $!"; print $text; close FILE;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 16:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found