|
Hi i am new to Perl and i was wondering if you could look at my scripts and give me advice and feedback on how i could improve my scripts.
I am using /etc/fb.modes to write Perl scripts. script 1- This script will read in the file and print one line at a time
#!/usr/bin/perl
open(INFO, `/etc/fb.modes`);
while($line = <INFO>)
{
print $line;
}
close INFO; Skip comments and empty lines
#!/usr/bin/perl
open(INFO, `/etc/fb.modes`);
next if $line = ~ /^#/; #skips comments
next if $line =//; #skips emptylines
while($line = <INFO>)
{
print $line;
}
close INFO; skips endmode lines
#!/usr/bin/perl
open(INFO, `/etc/fb.modes`);
next if $line = ~ /^#/; #skips comments
next if $line =//; #skips emptylines
next if $line =endmode;
while($line = <INFO>)
{
print $line;
}
close INFO;
How would i skip lines beginning with whitespace?
i want to split the header line in /etc/fb.modes
i want to split where the hyphens are and print out the first 2 fields on separate lines
for example
mode "640X480
75"
This is what ive done
#!/usr/bin/perl
open(INFO, `/etc/fb.modes`);
@line = split /-/, "mode "640X480-75";
print mode "\n" ;
print 75"\n";
print "=========================" "\n"; # i did this so its easy to read
|