09-24-2012
iterate is loop. You can while, for, foreach, until or goto; which does not much matter. Often I write with no loop first, then add an unconditional loop when I am about to repeat, then add a break where I can best discover I want to leave the loop.
Why not use while like while (not input eof){ read; process;}
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Can anyone tell me why this program won't kick out when the time gets beyond time in the loop?
sub showtime
{
local($format,$military)=@_;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
if ((! $military) && ($hour > 12)) {$hour-=12;}
... (2 Replies)
Discussion started by: methos
2 Replies
2. Shell Programming and Scripting
my $i;
my $j;
for($i=1;$i<=5;$i++)
{
for($j=$i;$j<5;$j++)
{
print " ";
}
print "$i\n";
}
But the output i need is
1
12
123
1234
12345
Help me please (5 Replies)
Discussion started by: priyas
5 Replies
3. Shell Programming and Scripting
I am using a Perl script to open a series of files in a loop, separate the paragraph into lines, and output the lines into a new file. The code works perfectly fine, except when the source file is over a certain size the loop gets stuck and won’t move on to the next file. It still does what it is... (0 Replies)
Discussion started by: renthead720
0 Replies
4. Shell Programming and Scripting
I need to process a file line-by-line using some value from a shell variable
Something like:perl -p -e 's/$shell_srch/$shell_replace/g' input.txt
I can't make the '-s' work in the '-p' or '-n' input loop (or couldn't find a syntaxis.)
I have searched and found... (4 Replies)
Discussion started by: alex_5161
4 Replies
5. Infrastructure Monitoring
Another newbie question... I can not figure out how to get this running using a loop. Here is what I have now.
#!/usr/bin/perl
use SNMP::Info;
$list="list.list";
open(DAT, $list) || die("Can't Open List");
@raw_data=<DAT>;
close(DAT);
foreach $dest (@raw_data)
{... (2 Replies)
Discussion started by: mrlayance
2 Replies
6. Shell Programming and Scripting
I am trying to print out a section of a file begining at the start and printng until a character is found.
My code and input file are below. This code is printing out every line except for the line with the character which is not what I want the out put should be a file with numbers 1-4.
... (3 Replies)
Discussion started by: cold_Que
3 Replies
7. Shell Programming and Scripting
I wrote a script to list all lines in a file with Perl. I am having trouble with the looping part of it. My script is supposed to look at the file and as long as the file is larger than the current line it prints a new line.
I am getting an error that won't stop on the while line of my code I... (4 Replies)
Discussion started by: zero3ree
4 Replies
8. Programming
I am trying to create a success and fail as below in a perl script :
while echo$? is 2 it should append as below to .fail file
=====================
if ( open(IN, "$outputfile"))
{
while( $my_line = <IN> )
{
#print "$my_line \n" ;
return 0;
... (3 Replies)
Discussion started by: sriram003
3 Replies
9. Shell Programming and Scripting
Hi All
I am reading the file using while loop in Perl someting like
while (my $s=<F>){
chomp($s);
..
..
..
}
What i want to do is after the chomp statement i used some condition, if the condition is met then it should move forward otherwise it should read the new line. How Can it be... (4 Replies)
Discussion started by: parthmittal2007
4 Replies
10. Shell Programming and Scripting
I have a script that needs to wait on another script to finish. I created a sub routine to check the file for the number 0 but my until statement keeps on going. I tried eq, == and =~ but same thing.
my $CHECKING_FILE = 1;
do {
sleep(5);
$CHECKING_FILE = check_file();
... (2 Replies)
Discussion started by: numele
2 Replies
LEARN ABOUT SUSE
gtk2::pagesetup
Gtk2::PageSetup(3) User Contributed Perl Documentation Gtk2::PageSetup(3)
NAME
Gtk2::PageSetup
HIERARCHY
Glib::Object
+----Gtk2::PageSetup
METHODS
pagesetup = Gtk2::PageSetup->new
pagesetup = Gtk2::PageSetup->new_from_file ($file_name)
o $file_name (localized file name)
May croak with a Glib::Error in $@ on failure.
Since: gtk+ 2.12
pagesetup = Gtk2::PageSetup->new_from_key_file ($key_file, $group_name)
o $key_file (Glib::KeyFile)
o $group_name (string or undef)
May croak with a Glib::Error in $@ on failure.
Since: gtk+ 2.12
double = $setup->get_bottom_margin ($unit)
o $unit (Gtk2::Unit)
$setup->set_bottom_margin ($margin, $unit)
o $margin (double)
o $unit (Gtk2::Unit)
double = $setup->get_left_margin ($unit)
o $unit (Gtk2::Unit)
$setup->set_left_margin ($margin, $unit)
o $margin (double)
o $unit (Gtk2::Unit)
$setup->load_file ($file_name)
o $file_name (string)
May croak with a Glib::Error in $@ on failure.
Since: gtk+ 2.14
$setup->load_key_file ($key_file, $group_name)
o $key_file (Glib::KeyFile)
o $group_name (string or undef)
May croak with a Glib::Error in $@ on failure.
Since: gtk+ 2.14
pageorientation = $setup->get_orientation
$setup->set_orientation ($orientation)
o $orientation (Gtk2::PageOrientation)
double = $setup->get_page_height ($unit)
o $unit (Gtk2::Unit)
double = $setup->get_page_width ($unit)
o $unit (Gtk2::Unit)
double = $setup->get_paper_height ($unit)
o $unit (Gtk2::Unit)
$setup->set_paper_size_and_default_margins ($size)
o $size (Gtk2::PaperSize)
papersize = $setup->get_paper_size
$setup->set_paper_size ($size)
o $size (Gtk2::PaperSize)
double = $setup->get_paper_width ($unit)
o $unit (Gtk2::Unit)
double = $setup->get_right_margin ($unit)
o $unit (Gtk2::Unit)
$setup->set_right_margin ($margin, $unit)
o $margin (double)
o $unit (Gtk2::Unit)
$setup->to_file ($file_name)
o $file_name (localized file name)
May croak with a Glib::Error in $@ on failure.
Since: gtk+ 2.12
$setup->to_key_file ($key_file, $group_name)
o $key_file (Glib::KeyFile)
o $group_name (string or undef)
Since: gtk+ 2.12
double = $setup->get_top_margin ($unit)
o $unit (Gtk2::Unit)
$setup->set_top_margin ($margin, $unit)
o $margin (double)
o $unit (Gtk2::Unit)
ENUMS AND FLAGS
enum Gtk2::PageOrientation
o 'portrait' / 'GTK_PAGE_ORIENTATION_PORTRAIT'
o 'landscape' / 'GTK_PAGE_ORIENTATION_LANDSCAPE'
o 'reverse-portrait' / 'GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT'
o 'reverse-landscape' / 'GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE'
enum Gtk2::Unit
o 'pixel' / 'GTK_UNIT_PIXEL'
o 'points' / 'GTK_UNIT_POINTS'
o 'inch' / 'GTK_UNIT_INCH'
o 'mm' / 'GTK_UNIT_MM'
SEE ALSO
Gtk2, Glib::Object
COPYRIGHT
Copyright (C) 2003-2008 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
perl v5.12.1 2010-07-05 Gtk2::PageSetup(3)