#!/usr/bin/perl -w

 use strict;
use warnings; $_='She is a good girl
and likes helping others
'; s/she/he/i;print "$_"; #he is a good girl
#and likes helping others s/hae/she/i;print "$_"; #he is a good girl
#and likes helping others s/(he)/$@ @/i;print; #he@ @ is a good girl
#and likes helping others s/s$/ours,/m;print; #he@ @ is a good girl
#and likes helping otherours, s/(\w*)ing/$/g;print; #he@ @ is a good girl
#and likes help otherours, $_ ='homeN home ome ooo
'; s/h/i/;print; #iomeN home ome ooo s/o/g/g;print; #igmeN hgme gme ggg s(gme)()g;print; #i123N h123 123 ggg s(n)(pppp)i;print; #i123pppp h123 123 ggg (my $copy = $_) =~ s/\s/__/g;print "$copy$_"; #i123pppp h12__12__ggg
#i123pppp h123 123 ggg #my $copy = $_ =~ s/3\s/__/g;print "$copy$_"; #i123pppp h123 123 ggg
#2i123pppp h12__12__ggg s/(\w*)/\U$/gi;print; #I123PPPP H123 123 GGG s/(\w*)\s(\w*)/\l$/i;print; #i123PPPP 123 GGG s/(GGG)/\u\L$/gi;print; #i123PPPP 123 spGgg print "\u\Lmy name is \Uyy\n"; #My name is YY my @split = split / /,$_;print "@split"; #i123PPPP 123 Ggg my @new_split = split;print"@new_split\n"; #123PPPP 123 Ggg my @new_split1 = split /\s/;print"@new_split1\n"; #123PPPP 123 Ggg my $glue = 'xxx';my $string = join $glue,@new_split;print "$string\n"; #i123PPPPxxx123xxxGgg $_ = 'aaa bb ddd';
my ($next1,$next2,$next3) = /(\S+) (\S+) (\S+)/;print "$next2\n"; #bb my %hash = ($string =~ /([A-Z]+)([-]+)/gi); foreach my $key(keys %hash)
{
print "$key and $hash{$key}\n";
} #PPPPxxx and 123
#i and 123 $_ = "a\nmmmmmmm\nabc\n\s\s\ssdsfs\n";
print "$1\n" if /(.*c$)/gm; #abc my $time = `date`;print "$time"; #Sun Jun 23 21:34:46 HKT 2019 $^I = ".bak"; my $input = <>;

问题:  cat .txt |perl test.pl 后并无备份文件1.txt.bak?

s///|s()()i|/i|/g|\U|\u|\L|\l|\U\l|split|join|匹配到hash|匹配到变量|`date`|$^I的更多相关文章

  1. g++ -I(大写i) 与-L(大写l)-l(小写l) 的作用与学习

    linux 下 g++编译程序时,-I(大写i) 与-L(大写l)-l(小写l) 的作用 作为一个linux入门级使用者,gcc/g++ 的简单操作已经用过多次, 但是有时稍微复杂一点的程序就会使用到 ...

  2. SqList *L 和 SqList * &L的区别/学习数据结构突然发现不太懂 小祥我查找总结了一下

    小祥在学习李春葆的数据结构教程时发现一个小问题,建立顺序表和输出线性表,这两个函数的形参是不一样的. 代码在这里↓↓↓ //定义顺序表L的结构体 typedef struct { Elemtype d ...

  3. gcc -l参数和-L参数

    转自:http://www.cnblogs.com/benio/archive/2010/10/25/1860394.html -l: -l参数就是用来指定程序要链接的库,-l参数紧接着就是库名,那么 ...

  4. gcc “-I”(大写i),“-L”(大写l),“-l”(小写l)的区别

    我们用gcc编译程序时,可能会用到“-I”(大写i),“-L”(大写l),“-l”(小写l)等参数,下面做个记录: 例: gcc -o hello hello.c -I /home/hello/inc ...

  5. Linux统计文件/目录数量ls -l | grep "^-" | wc -l匹配开头和结尾

    Linux统计文件数量 ls -l | grep "^-" | wc -l “^-”  一般文件 “^d” 目录文件 shell/vim中^表示开头 cat repatterns ...

  6. 链表中LinkList L与LinkList *L 借鉴

    链表中LinkList L与LinkList *L的区别以及(*L).elem,L.elem L->next,(*L)->next的区别typedef struct Node{int el ...

  7. linux之ls -l|grep "^-"|wc -l命令

    查看某文件夹下文件的个数 ls -l |grep "^-"|wc -l 或 find ./company -type f | wc -l 查看某文件夹下文件的个数,包括子文件夹里的 ...

  8. 十八、泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器基础加强

    l 泛型 l 注解 l Servlet3.0 l 动态代理 l 类加载器 泛型 1 回顾泛型类 泛型类:具有一个或多个泛型变量的类被称之为泛型类. public class A<T> { ...

  9. Python之L.reverse()和L.sort()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #Python之L.reverse()和L.sort() #http://python.jobbole.com ...

随机推荐

  1. 洛谷 - P1063 - 能量项链 - 区间dp

    https://www.luogu.org/problemnew/show/P1063 这个并不是每次只能从两边扩展的,可以从中间断开. #include<bits/stdc++.h> u ...

  2. 移动端tab目录(有待完善)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  3. 51nod1102(单调栈/预处理)

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1102 题意:中文题诶- 思路:单调栈/预处理 (这篇博客就不 ...

  4. React入门看这篇就够了

    摘要: 很多值得了解的细节. 原文:React入门看这篇就够了 作者:Random Fundebug经授权转载,版权归原作者所有. React 背景介绍 React 入门实例教程 React 起源于 ...

  5. HTTPRunner实践二——数据驱动

    基于文档http://cn.httprunner.org/advanced/data-driven/ 场景一:用例集+独立参数+参数列表 1.原始用例文件savePatient_01.yml - co ...

  6. SpringBoot2.0 基础案例(13):基于Cache注解模式,管理Redis缓存

    本文源码 GitHub地址:知了一笑 https://github.com/cicadasmile/spring-boot-base 一.Cache缓存简介 从Spring3开始定义Cache和Cac ...

  7. 安卓下点击a标签不跳转;点击a标签在手机真机上会调出手机键盘的解决办法

    安卓下点击a标签不跳转的解决办法,是不用href做跳转的链接,改为用JS控制跳转 <a href="javascript:;" ontouchstart="wind ...

  8. jave (java的ffmpeg框架)简单使用

    引入文件( jave-native-win64 windows 64位系统jave-native-linux64 linux 64位系统按自己服务器系统来替换 ) <dependency> ...

  9. C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report

    ceil有毒啊..用ceil一直错. 思路就是模拟吧,设当前的答案是ansx和ansy. 如果比例是小于ansx的,那么就要乘以一个倍数k1,使得a * k1 >= ansx的. 所以就用cei ...

  10. (转)企业配置sudo命令用户行为日志审计

    原文:https://www.cnblogs.com/Csir/p/6403830.html?utm_source=itdadao&utm_medium=referral 第15章 企业配置s ...