how to repeat non-atom patterns

2008-03-27 Thread ciwei
; but it unable to match. any suggestions. Thanks. ciwei -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Q: how to rename file with space in filename

2008-03-20 Thread ciwei
uot;\n" if /(\w+)\s+file$/' first second third now try use rename # ls -1 | perl -ne 'rename $_ , $1 if /(\w+)\s+file$/' won't work, like nothing happed? why? Thanks in advance. ciwei -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

order of command line switch?

2008-02-13 Thread ciwei
hostA>ls SUNWjassVRTSVRTSicsco VRTSvcs emc SUNWmlibVRTSalloc VRTSjre VRTSvlicVRTSvxvm hostA>ls | perl -en 'print if /SUNW/' return nothing , while hostA>ls | perl -ne 'print if /SUNW/' SUNWits SUNWjass SUNWmlib SUNWrtvc so why the order of -n -e switch mak

space in variable referencing

2008-01-12 Thread ciwei
Question from a newbie: how to properly use space when reference to variables, array, hash etc. please see the code below: why the first line, second, and third line all output differiently. thanks. ciwei code below == #!/usr/bin/perl my %ttys =(); open ( WHO, "who|") o

Re: Q: how to push into array

2008-01-12 Thread ciwei
thanks for the reply. I was not able to figure out how the code works. I have commented the code below. can you help explain it a bit? thanks. On Jan 10, 9:41 am, [EMAIL PROTECTED] (Chas. Owens) wrote: > > __DATA__ > >              DEV01-HBA0_DMX1-13CA  <-- begin of record > >              

Re: Q: how to push into array

2008-01-10 Thread ciwei
> push @{ $wwn{ "$host-$hba"   } }, /^\s+WWN:\s+(1000[0-9a-fA-F]{12})$/; Thanks for the help. can you please explain in the above line , what the { } around push @{ $wwn ... } <--here do ? is the { } here optional? or can this be subsitute with ( )? thanks. -- To unsubscribe, e-mail: [EMAIL

Re: Q: how to push into array

2008-01-10 Thread ciwei
Thanks for answering my question. > I don't understand your second question, could you break your input > into records so we can clearly see what how you want to define the > records? My data looks like this: the rcord is variable in the number of lines. I'm tring to push all WWN that start with 1

Q: how to push into array

2008-01-09 Thread ciwei
st be array (not hash elem) at ./ emc_parse_switch_zone.pl line 20, near "$1 if" Execution of ./emc_parse_switch_zone.pl aborted due to compilation errors. so my questions: 1. what is wrong with push here? 2. how to properly determine the boundaris of the records. each record ending with the las