Perl file and STDERR

2013-07-09 Thread jitendra B
Hi All, Can you please let me know the following snippset? why it is used for? select( STDERR ); $| = 1; select( STDOUT ); $| = 1; print STDERR "\nThis is india\n\n"; print STDERR "Usage: This is build"; print STDERR "where: base PL label\n"; and second question second ques

Re: Perl file and STDERR

2013-07-09 Thread John W. Krahn
jitendra B wrote: Hi All, Hello, Can you please let me know the following snippset? why it is used for? select( STDERR ); Select STDERR as the default filehandle. $| = 1; Turn on autoflush for the current default filehandle. (Redundant because STDERR autoflushes by default.) selec

Re: Perl file and STDERR

2013-07-09 Thread Shawn H Corey
On Tue, 9 Jul 2013 13:24:54 +0530 jitendra B wrote: > Can you please let me know the following snippset? why it is used for? > > > select( STDERR ); Change the default file handle use by `print` and `say` to STDERR. The default file handle is use when no file handle is specified. Example:

Re: Perl file and STDERR

2013-07-09 Thread Nathan Hilterbrand
See below > Hi All, > > > Can you please let me know the following snippset? why it is used for? > > > select( STDERR ); > $| = 1; > select( STDOUT ); > $| = 1; > print STDERR "\nThis is india\n\n"; > print STDERR "Usage: This is build"; > print STDERR "where: base PL label\n"; > > and second

Re: Perl file and STDERR

2013-07-09 Thread Andy Bach
On Tue, Jul 9, 2013 at 9:37 AM, Nathan Hilterbrand wrote: > I want to open a file read+write mode and change > > the > > some content in same file without creating another file and copy to it. > You might want to look at the perl "in place mode" [1], so something like perl -i.bak -pe ' s/BLR/ban

Re: Perl file and STDERR

2013-07-09 Thread jitendra B
Thank you very much Andy, Nathan, Shawn for your kind help. I am new to the perl. Why auto-flush is needed here (STDERR autoflushes)? It will free the memory or something else. Regards, Jitendra On Tue, Jul 9, 2013 at 9:10 PM, Andy Bach wrote: > > On Tue, Jul 9, 2013 at 9:37 AM, Nathan Hilt

Re: Perl file and STDERR

2013-07-10 Thread shawn wilson
On Jul 10, 2013 2:01 AM, "jitendra B" wrote: > > Thank you very much Andy, Nathan, Shawn for your kind help. > > I am new to the perl. Why auto-flush is needed here (STDERR autoflushes)? > Probably for consistency with autoflush being enabled for STDOUT, it's also on with STDERR. It's an optimiza

Re: Perl file and STDERR

2013-07-10 Thread Shawn H Corey
On Wed, 10 Jul 2013 04:57:44 -0400 shawn wilson wrote: > On Jul 10, 2013 2:01 AM, "jitendra B" wrote: > > > > Thank you very much Andy, Nathan, Shawn for your kind help. > > > > I am new to the perl. Why auto-flush is needed here (STDERR > > autoflushes)? > > > > Probably for consistency with a

Re: Perl file and STDERR

2013-07-10 Thread Andy Bach
On Wed, Jul 10, 2013 at 7:08 AM, Shawn H Corey wrote: > Auto-flush is a de-optimization. Don't set it. More "Best Practices" on autoflush (note, the original book "Perl Best Practices" by Damian Conway is well worth the price. Even for those few you may not agree with, practices-wise, you'll le

Re: Perl file and STDERR

2013-07-10 Thread Shawn H Corey
On Wed, 10 Jul 2013 10:49:37 -0500 Andy Bach wrote: > On Wed, Jul 10, 2013 at 7:08 AM, Shawn H Corey > wrote: > > > Auto-flush is a de-optimization. Don't set it. > > > > More "Best Practices" on autoflush (note, the original book "Perl Best > Practices" by Damian Conway is well worth the p

Re: Perl file and STDERR

2013-07-10 Thread Kenneth Wolcott
On Wed, Jul 10, 2013 at 9:21 AM, Shawn H Corey wrote: > On Wed, 10 Jul 2013 10:49:37 -0500 > Andy Bach wrote: > >> On Wed, Jul 10, 2013 at 7:08 AM, Shawn H Corey >> wrote: >> >> > Auto-flush is a de-optimization. Don't set it. >> >> >> >> More "Best Practices" on autoflush (note, the original boo